Adam
Adam

Reputation: 2455

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': [email protected]
Password for 'https://[email protected]@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/'

Upvotes: 2

Views: 721

Answers (3)

TT--
TT--

Reputation: 3195

Worked for me:

  1. 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

  2. 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 )

  3. 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

Upvotes: 0

AlexPixel
AlexPixel

Reputation: 439

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 [email protected]: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://[email protected]/.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.

Upvotes: 2

Abhay Saraf
Abhay Saraf

Reputation: 1212

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.

Upvotes: 0

Related Questions