I have a project hosted on GitHub. I fail when trying to push my modifications on the master. I always get the following error message
Password for 'https://[email protected]':
remote: Invalid username or password.
fatal: Authentication failed for 'https://[email protected]/eurydyce/MDANSE.git/'
However, setting my ssh key to github seems ok. Indeed, when I do a ssh -T [email protected]
I get
Hi eurydyce! You've successfully authenticated, but GitHub does not provide shell access.
Which seems to indicate that everything is OK from that side (eurydyce being my github username). I strictly followed the instructions given on github and the recommendations of many stack discussion but no way. Would you have any idea of what I may have done wrong?
https://[email protected]/eurydyce/MDANSE.git is not an ssh url, it is an https one (which would require your GitHub account name, instead of 'git
').
Try to use ssh://[email protected]:eurydyce/MDANSE.git
or just [email protected]:eurydyce/MDANSE.git
git remote set-url origin [email protected]:eurydyce/MDANSE.git
The OP Pellegrini Eric adds:
That's what I did in my
~/.gitconfig
file that contains currently the following entries[remote "origin"] [email protected]:eurydyce/MDANSE.git
This should not be in your global config (the one in ~/
).
You could check git config -l
in your repo: that url should be declared in the local config: <yourrepo>/.git/config
.
So make sure you are in the repo path when doing the git remote set-url
command.
As noted in Oliver's answer, an HTTPS URL would not use username/password if two-factor authentication (2FA) is activated.
In that case, the password should be a PAT (personal access token) as seen in "Using a token on the command line".
That applies only for HTTPS URLS, SSH is not affected by this limitation.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments