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
For me, running git on Windows7 using git-bash, running:
git push origin master
Got it working. That prompted Windows7 to ask again for my git creds, and then stored them (whereever Windows does), to update the password.
If you have setup Github 2FA Auth, you need a personal access token (in place of your github password in git cli), follow this instructions to create it: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
Then do something like
git checkout master
git pull origin <--- At this point you'll be asked for your credentials, enter your normal github user and as password paste the token generated in the link above.
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://Username@github.com/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".
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.
To update the password in your Terminal. Try the below command, It will prompt you password again.
git push -u origin master
You can update the Username and password by this command:
$ git remote set-url origin https://<USERNAME>:<PASSWORD>@github.com/path/to/repo.git
make sure to change USERNAME to your git username and PASSWORD to your new git password.
Next git push
should work for you.
Learn more about it in this article