remote: Invalid username or password. fatal: Authentication failed


Question or issue on macOS:

I’m just getting started with Git/Github and I’m completely stuck. I’m using Terminal on Mac/OSX El Capitan and when it asks for password it tells me it is invalid, but I am entering the same password that I created for my GitHub account, so surely this should work? What am I doing wrong?

Last login: Sun Dec  4 10:46:35 on ttys000
Seans-MBP:~ mrseanbaines$ git push -u origin master
Username for '': mrseanbaines
Password for 'https://[email protected]': 
remote: Invalid username or password.
fatal: Authentication failed for ''
Seans-MBP:~ mrseanbaines$

How to solve this problem?

Solution no. 1:

I had faced same issue.
Step 1: Control Panel
Step 2: Credential Manager
Step 3: Click Window Credentials
Step 4: In Generic Credential section ,there would be git url, edit and update username and password
Step 5: Restart Git Bash and try for clone
enter image description here

Solution no. 2:

(1) Go to , turn off Two-factor authentication.

(2) Create a new folder, inside the new folder:

git clone
cd cartwheeling-kitten

Open empty source code directory, since you use macOS, type

open .

(3) Copy your source code to folder cartwheeling-kitten (it’s the opening folder)

(4) Config

git config "Your full name"
git config "Your_email_address_what_used_to_register Github_account"

(5) Add remote URL

git remote add upstream

(6) Add to stage, then push

git add -A .
git commit -m "Upload source code"
git push -u origin master

(7) Go to see result.

Solution no. 3:

2020 – When you change your password on Github and after in your local machine it will complain about credentials but you can easily fix it doing a git pull which will force asking you the credentials. So you type the new one and be happy :). šŸ˜Š

Solution no. 4:

Once you have enabled 2 Factor Authentication (2FA) on GitHub, you cannot use your GitHub password on the command line. Instead, you have to use a personal access token.

Personal access tokens are used to authenticate you for personal applications and on the command line. The command line does not tell us we need to generate a personal access token, which is why this solution is often overlooked by programmers.

Navigate to the ā€œSettingsā€ page
Click ā€œDeveloper settingsā€ in the sidebar
Click ā€œPersonal access tokensā€ in the sidebar
Click ā€œGenerate new tokenā€
Fill in the form to create a new token

Use that token as password and git clone will work work

Solution no. 5:

Make sure your remote urls are correct. It looks like you’re missing the protocol, it should be: You can verify this by cloning the repo to another directory, and trying git operations there.

If you want to fix it to add the protocol, you can do: git remote set-url origin

Solution no. 6:

If you already have setup SSH key in your system for some other git account then just do these steps

and check activation using ssh -T [email protected]
if you see ‘Hi GitAccountUserName! You’ve successfully authenticated, but GitHub does not provide shell access.’

Then continue your previous work.

Solution no. 7:

When I tried to push the code into remote repo from local (macbook), I faced the same issue after PASSWORD reset on GHE website.

$ git push -u origin coffee_shop_autorization

remote: Invalid username or password.

fatal: Authentication failed for ‘‘

Then I followed below simple steps to fix this issue:

  1. I cloned another repository from GHE to local in different folder:

    git clone

  2. I switched to this folder by ‘cd bookshelf
  3. I tried to push the same without making any changes as below:

    git push

  4. It prompted for Username for ‘‘:<Provide your GHE user name> then press enter.
  5. It prompted as Password for ‘https://[email protected]‘: <provide
    updated password on GHE
    > then press enter
  6. You will see this message as “Everything up-to-date”

All Done.

Now go to your previous local repo where you tried to push the code into remote and execute your previous command

git push -u origin coffee_shop_autorization

It will push the code into remote repo and you can see similar as below (with your repo and branch details):

Enumerating objects: 35, done.

Counting objects: 100% (27/27), done.

Delta compression using up to 4 threads

Compressing objects: 100% (14/14), done.

Writing objects: 100% (15/15), 2.47 KiB | 843.00 KiB/s, done.

Total 15 (delta 8), reused 0 (delta 0)

remote: Resolving deltas: 100% (8/8), completed with 5 local objects.


remote: Create a pull request for ‘coffee_shop_autorization’ on GitHub by visiting:




  • [new branch] coffee_shop_autorization -> coffee_shop_autorization
    Branch ‘coffee_shop_autorization’ set up to track remote branch ‘coffee_shop_autorization’ from ‘origin’.

Hope this helps!