After I changed my GitHub password, I am unable to push to the remote:
$ git push origin master
remote: Invalid username or password.
Is th
Ok, the original post is quite old, but it's the top result in Google and none of the answers worked for me. Several other SO and GH posts didn't work either. Posting this to help anyone following me here!
My situation is slightly different: Personal GH account, pushing to a private Company repo, using SSH and the git command line on Mac. My password is not stored either in my .gitconfig
nor in any keychain nor in git credential.helper
.
In the example below PersonalName is my GH account, CompanyName is the company (the owner of the repo on GH) and RepoName is the repository.
My original error message was somewhat different also: attempting git push origin master
resulted in
remote: Repository not found.
fatal: repository 'https://github.com/CompanyName/RepoName.git/' not found
The remote was working before my GH password change, and I didn't want to remove the remote because I had local changes that I needed to push.
Eventually a reply by seveas to this question on the GitHub Community Forum pointed me in the right direction. The key thing was to link my GH account name with the remote (private) repo.
This worked for me:
git remote set-url origin https://PersonalName@github.com/CompanyName/RepoName.git
Then
git remote show origin
prompted with
Password for 'https://PersonalName@github.com':
I was able to enter my new password, see the remote details and git push origin master
succeeded.
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/
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
The username and password may be stored in Windows Credential Manger. Check and update there, if necessary.
(I know that's a bit obvious and simple, but might help some people.)