Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changed GitHub password, no longer able to push back to the remote

Tags:

git

github

People also ask

Why I Cannot push to GitHub authentication failed?

If you enabled two-factor authentication in your GitHub account you won't be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your GitHub account.

Why is GitHub not pushing my code?

That means your local repository is outdated and there are some new changes in remote repository which are not present in local. git pull = git fetch and merge. so if you are doing git fetch, you have to merge your changes explicitly.


If you had your remote's password changed only, not the username, then try the following command to check remote's info:-

git remote show origin

This will ask for your password for the given git user, fill that in correctly, and now try:-

git pull

or,

git push

It should work unless you have to change other things like username or remote URL, you can take a look at the following Git documentation:-

https://help.github.com/articles/setting-your-username-in-git/

https://help.github.com/articles/changing-a-remote-s-url/


To update the password in your Terminal. Try the below command, It will prompt you password again.

git push -u origin master

The OP kenu.heo has worked around the issue by removing, then re-cloning the repo.

But for other:

It depends on your OS, git version and protocol you are using.

Depending on the OS, you have ways to cache your credentials (OSX KeyChain on Mac, netrc credential helper on Windows or Linux), and that could explain why your push isn't working after changing your GitHub password.
For a keychain, you would need to reset that password stored in it.

That password issue also suggest that you are using an https url (not an ssh one, which would depends on public/private ssh keys, and wouldn't be influenced by a GitHub account password, since the public SSH key registered to your GitHub account wouldn't have changed).

Check that with a git remote -v.

You can force git to use your GitHub login with a:

git remote set-url origin https://[email protected]/Username/MyRepo.git

(replace 'Username' and 'MyRepo.git' by your own values)

Then try again to push, it should ask for your GitHub password. Enter the new one.

If this doesn't work, check if you have activated the 2FA (2-Form Authentication). If that is the case, you need to generate a PTA (Personal Token Access).
See more at "Configure Git clients, like GitHub for Windows, to not ask for authentication".


On a Windows System none of the steps worked for me, the problem is that the credentials are stored in Windows Credentials Manager.

You can go to Control Panel -> User Accounts -> Credential Manager -> Windows Credentials

Under Generic Credentials you will find your git Url, expand the selection and click on edit.

Once edited just trigger a git push again and it should work.

Source of information :- Remove credentials from Git


From what I've experienced, you just need to re-enter the remote-addr.

And git will ask usr/password for the new one rather than keeping silent and use the deprecated one.

see your remotes, locate which one you want to change

>git remote  
github
gitcafe
company

for example, if you changed your company repo password, you can do:

>git remote remove company

This won't touch your folder, won't touch your commits. This just delete a url-string from git

Then, add this url again:

>git remote add company https://git.AyCramba.com/xxx.git

Push to it:

>git push company master
username for 'https://git.AyCramba.com':
password for 'https://git.AyCramba.com':

Then it starts pushing

Hope it helps.