Git Authentication Failed, remote: invalid username or password

Viewed 85

I am trying to push some edits from my local repo to my GitHub but I get this error:

(base) herasyed@MacBook-Air-3 MechaCar_Statistical_Analysis % git add .       
(base) herasyed@MacBook-Air-3 MechaCar_Statistical_Analysis % git status
On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    new file:   .DS_Store
    renamed:    MechaCarChallenge.R -> R Code/MechaCarChallenge.R

(base) herasyed@MacBook-Air-3 MechaCar_Statistical_Analysis % git push
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/herasyed/MechaCar_Statistical_Analysis.git/'

I can pull from my Git fine and my SSH key seems to be working.

1 Answers

my SSH key seems to be working.

Your SSH key is not used at all, considering the remote URL used is an HTTPS one.

If you want to use SSH:

cd /path/to/repo
git remote set-url origin git@github.com:herasyed/MechaCar_Statistical_Analysis.git
git push

See if the push succeeds then.

Related