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?
You might be getting this error because you have updated your password. So on Terminal first make sure you clear your GitHub credentials from the keychain and then push your changes to your repo, terminal will ask for your username and password.
The “fatal: Authentication failed” error message Instead you need to generate a personal access token. This can be done in the application settings of your Github account. Using this token as your password should allow you to push to your remote repository via HTTPS. Use your username as usual.
Invalid User Name/Password combination" error when trying to login to my account? Usually, this means that either the User ID or Password that you're using to sign in, is invalid. You will want to make sure that you're entering both your User ID and Password correctly.
username and password. We can supply the username and password along with the git clone command in the remote repository url itself. The syntax of the git clone command with the http protocol is, git clone http[s]://host.
After enabling Two Factor Authentication (2FA), you may see something like this when attempting to use git clone
, git fetch
, git pull
or git push
:
$ git push origin master Username for 'https://github.com': your_user_name Password for 'https://[email protected]': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/your_user_name/repo_name.git/'
From the GitHub Help documentation:
After 2FA is enabled you will need to enter a personal access token instead of a 2FA code and your GitHub password.
...
For example, when you access a repository using Git on the command line using commands like
git clone
,git fetch
,git pull
orgit push
with HTTPS URLs, you must provide your GitHub username and your personal access token when prompted for a username and password. The command line prompt won't specify that you should enter your personal access token when it asks for your password.
Related question: https://stackoverflow.com/a/21374369/101662
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With