Heroku : Username for 'https://git.heroku.com': git - windows

I'm trying to check a git remote on heroku:
$ heroku auth:logout
Local credentials cleared.
$ heroku auth:login
Enter your Heroku credentials.
Email: ***#gmail.com
Password (typing will be hidden):
Authentication successful.
$ git remote
heroku
origin
$ git remote show heroku
Username for 'https://git.heroku.com':
Password for 'https://git.heroku.com':
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
fatal: Authentication failed for 'https://git.heroku.com/***-1909.git/'
This error is referenced in the heroku docs, in the screenshot above at https://devcenter.heroku.com/articles/git , but I'm not sure what to do next to fix this.

This is what worked for me.
$ heroku auth:token
Use the result as the password when prompted.

As the warning says, you just need to do:
heroku login
And it will open your browser for logging in, enter details as per your authentication and you will be good to roll in.

I solve this issue no implicit conversion from nil to integer (TypeError) by it by pushing the updates to heroku and when they asked for the user name I added my email and the password it's in this link https://dashboard.heroku.com/account in API KEYS
Username for 'https://git.heroku.com': your email
Password for 'https://email#git.heroku.com': API KEYS

Run this
heroku login
git add .
git commit -m "..."
git push heroku main
This is going to work

After logged with: heroku login
Some access for example on cloning an existing project in your account, is not
allowed using git native even stay you logged in, and only using git from heroku, such as:
heroku git:[command]
an example clonning a repository:
heroku git:clone -a [app_name]
Otherwise, sometimes, after logged with heroku login, you can check your remote git with: git remote -v
Other way, is you use heroku auth:token and use their output as password, of course, run it after logged.

Related

Heroku push failed in Windows + Git bash

I execute:
> heroku login
and introducing my Heroku username and password, I get:
Logged in as l*********.com
I can execute successfully:
> heroku auth:token
cccc8aa0-aaaa-aaaa-aaaa-bbbb03b38932
after that, I execute:
> git push heroku master
but I get:
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
remote: ! See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://git.heroku.com/myapp.git/'
What am I doing wrong? It says that I should "not authenticate with username and password using git".. but in that case, what should I do? The docs say:
You cannot authenticate with the Heroku HTTP Git endpoint using your Heroku username (email) and password. Use an API key as described in this section
But it's hard to understand what I should actually do.
I was able to fix it using SSH protocol:
Generate a key: ssh-keygen -t rsa
Upload it to Heroku heroku keys:add
Switching to SSH: git config --global url.ssh://git#heroku.com/.insteadOf https://git.heroku.com/

Push Changes to Git not Functioning

Every time I want to commit the command "git push heroku master" I am asked in the PowerShell to enter the credentials. When I enter heroku credentials (which is connected to git by default) I get the error message.
But, when I type the credetials contained in the netrc file in my home directory, then the thing functions. The password is however hashed in my opinion. How can I avoid entering credentials every time I want to push changes to git?
UPDATE:
PS C:\Users\Dragan\heroku_workspace\python-getting-started> git push heroku master
github --credentials get: github: command not found
Username for 'https://git.heroku.com': my-email#hotmail.com
Password for 'https://my-email#hotmail.com#git.heroku.com':
github --credentials erase: github: command not found
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
remote: ! See documentation for details: Https://devcenter.heroku.com/articles/http-git#authentication
fatal: Authentication failed for 'https://git.heroku.com/mysterious-river-71834.git/'
A common mistake is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking the ssh button left to the URL field and updating the URL of your origin remote like this:
git remote set-url origin git#github.com:username/repo.git
or if your repository already then click green button CLONE OR DOWNLOAD and select use SSH
Enable SSH authentication
$ heroku create --ssh-git
Redirect tall HTTPS calls to SSH ( If you want to always use SSH Git with Heroku on a particular machine)
$ git config --global url.ssh://git#heroku.com/.insteadOf https://git.heroku.com/
To generate a public key:
ssh-keygen -t rsa Press enter at the first prompt to use the default file location. Next, type a secure passphrase for the key.
If you are using v1.9.3 or later Git for Windows, you can do the following
git config --global credential.helper wincred
Please note that this mechanism stores your username/password in Windows Credential Store.
In relatively newer versions, Git Credential Manager for Windows is bundled with Git for Windows and enabled by default, you might have to override credential.helper configuration for Heroku. GCM seems designed for VSTS and GitHub and I am not how it will behave with other servers.
Worked for me:
Run heroku login using the windows command prompt cmd.exe. This will drop your API key into your _netrc at which point you can open up cygwin or git bash and do whatever you need to
From .gitconfig remove the helper = manager line so that it is no longer registered as a credential helper and stops it from showing up.
(in C:\Users\username\.gitconfig )
Rename _netrc file to .netrc on Windows 7 in the user dir:
cd %home%
REN _netrc .netrc
see:
'git push heroku master' is still asking for authentication
https://github.com/heroku/cli/issues/84#issuecomment-170689175

Authentication failure in Heroku CLI after password change

After a password change on heroku's website, I can't access the heroku api.
When I do heroku login, I get Authentication successful, even though it shouldn't because the password has changed. It doesn't even ask for my email or password, like it should!
If I try heroku apps (or any other application related command), I get Authentication failure.
If I try heroku status, it works.
I don't have any plugins installed.
Logs:
$ heroku version
heroku-gem/3.6.0 (i686-linux) ruby/2.1.0
$ heroku logout
Local credentials cleared.
$ heroku login
Authentication successful.
$ heroku apps
Authentication failure
$ heroku plugins
You have no installed plugins.
I'll appreciate any help or ideas I can get. I already opened a ticket and waiting for the Heroku Support to get back to me.
Thanks
After a password change on heroku's website, I can't access the heroku api.
Are you using the heroku-accounts plugin? If so, try uninstalling it.
heroku plugins:uninstall heroku-accounts
rm -r ~/.heroku/accounts
heroku logout
heroku login
https://github.com/ddollar/heroku-accounts/issues/56
Apparently, changing the password for heroku regenerates a new API key, and I had the wrong HEROKU_API_KEY configured. (It regenerates a new one after password change).
I'm posting here the response from the great Heroku's support team, which gave me these suggestions:
Is there a ~/.netrc file on your computer? If there is, can you please check if the file contains something Heroku related things? Please remove if there is, and try login again.
Is there an HEROKU_API_KEY environment variable defined on your machine? If yes, could you remove it and login try again?
Is there a ~/.heroku/credentials file (with or without an extension) on your machine? If yes, could you remove it and try login again?
Finally, if none of those work, could try the following command: GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' heroku login and see how it goes?
Are you using the heroku-accounts plugin? If so, try uninstalling it.
You may not need to uninstall it...
Make sure you are not in a project directory (or you may run into the "account not found" loop).
cd
List your accounts.
heroku accounts
On each account where the password was changed
heroku accounts:remove ACCOUNT
heroku accounts:add ACCOUNT
(I did not need to do anything with the ~/.ssh/config.)
Reset your default account, if needed.
heroku accounts:default ACCOUNT
If you changed the account name or git config --unset heroku.account.
cd /path/to/your/project
git config --add heroku.account ACCOUNT
I didn't want to give up on the heroku-accounts plugin. :)
heroku accounts:remove personal or whatever account name you have
git config --unset heroku.account
heroku accounts:add personal then login
In my case, I had multiple heroku accounts managed by heroku-accounts gem and authentication started failing after I changed one of my account's password.
Steps I followed to make things normal again:
Removed the account (that's failing to authenticate) from heroku accounts:
heroku accounts:remove account_name
Opened up a new terminal and then added the account again that I just deleted:
heroku accounts:add account_name --auto
Here you have to use your new credentials.
That's it. Problem solved.
Try deleting ~/.netrc (this is where the Heroku CLI tool saves the auth tokens) and starting over.

Failed to deploy application to heroku

I am newbie into heroku. I was trying to deploy a Django application to heroku by following steps.
Installed vartualenv
Installed Django gunicron via pip
Installed heroku toolbelt
Created an empty git
git add .
git commit -m "First commit"
ssh-keygen
heroku create
heroku keys:add
git push heroku master
And the a error
(venv)han#HEEL:~/Desktop/projects/ossko$ heroku keys:add
Found existing public key: /home/han/.ssh/id_rsa.pub
Uploading SSH public key /home/han/.ssh/id_rsa.pub... done
(venv)han#HEEL:~/Desktop/projects/ossko$ git push heroku master
ssh: connect to host heroku.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have follow every steps from heroku help site.
Please help me to fix this error
I have Ubuntu 13.4 64bit os
Update: here is the result of git remote -v:
$git remote -v
heroku git#heroku.com:infinite-mesa-xxx.git (fetch)
heroku git#heroku.com:infinite-mesa-xxx.git (push)
Try running git remote -v. Does it give you more than one remote, like this?
your_app_name git#heroku.com:your_app_name.git (fetch)
your_app_name git#heroku.com:your_app_name.git (push)
If the remote depot is named something other than 'heroku' you will need to specify the push to that site instead. For example, if your remote is named ossko, try something like
git push ossko master
Often you will have different names for remote depots if you have more than one heroku app - you can use a different name for each app.
Ok, i just solved the problem, This problem is with adding ssh key.
So the correct commands for heroku deploying is
nihan#heel:~$ heroku login
Enter your Heroku credentials.
Email: debashis.dip#gmail.com
Password (typing will be hidden):
Authentication successful.
nihan#heel:~$ cd dev/flask-app
nihan#heel:~/dev/flask-app$ heroku keys:clear
Removing all SSH keys... done
nihan#heel:~/dev/flask-app$ heroku keys:add
Found existing public key: /home/nihan/.ssh/id_rsa.pub
Uploading SSH public key /home/nihan/.ssh/id_rsa.pub... done
nihan#heel:~/dev/flask-app$ ssh-add ~/.ssh/id_rsa <---- This was the missing key
Enter passphrase for /home/nihan/.ssh/id_rsa:
Identity added: /home/nihan/.ssh/id_rsa (/home/nihan/.ssh/id_rsa)
nihan#heel:~/dev/flask-app$ git push heroku master
Because my ssh never knew which key to use it somehow have heroku the wrong information and that's why heroku was denying.

How to attach my repo to heroku app

I create a heroku app and then my machine crashed. I have a new machine. How do I attach my existing app to heroku app. When I visit heroku page the url for my app is like this
git#heroku.com:myapp.git
I can't do clone this app because I already have myapp from github. So I need to add heroku as remote to my existing github app. Anyone knows the syntax.
If you've heroku toolbelt:
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
Credits: user101289's solution
Else if you don't have heroku toolbelt:
First do this:
git remote add heroku git#heroku.com:{heroku-app-name}.git
Then do this:
git push heroku master
heroku open
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
If you're using just Git without installing the Heroku Toolbelt, you can also create a new application.
Login to your account and go to this link
https://dashboard.heroku.com/apps
Look at the plus sign on the top right corner then select
Create new app
Leave the application name blank to let heroku choose one for you.
Let say your heroku app name is new-app-xxxxx, so to test on adding a file in to it you may try the following command:
git clone https://git.heroku.com/<new-app-xxxxx>.git
cd <new-app-xxxxx>
echo "my test file" > test.txt
git add .
git commit . -m "my test on commit"
git push
Put empty (blank) when the Git prompt for username, and your API Key for the password. You can get your API Key by showing it from the link below.
https://dashboard.heroku.com/account
Note: You cannot authenticate with the Heroku HTTP Git endpoint using your Heroku username (email) and password. Use an API key as described here.

Resources