0

I have once already done a local git with the CLI but with a different account. For reference I used this video: https://www.youtube.com/watch?v=DVRQoVRzMIY&ab_channel=TechWithTim

That account works, but I wanted to create a new one. After that, I successfully created the new one and typed:

git config --global user.name "Your Name"

and

git config --global user.email "youremail@yourdomain.com"

When I did this for my first account I was able to

git push -u origin main

without having any problems, however, now that I have done it again for my second account I received this error:

remote: Permission to lunAr-creator/learning_python.git denied to Slow-Scallion4183. fatal: unable to access 'https://github.com/lunAr-creator/learning_python.git/': The requested URL returned error: 403

Slow-Scallion3184 is my first account, lunAr-creator is my second

Is there a way I can fix this? Any help would be greatly appreciated!

Edit: After I tried what was suggested in the comments I just received this error:

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
RafsanJany
  • 355
  • 1
  • 10
some_user_3
  • 403
  • 1
  • 5
  • 17
  • Does this answer your question? [Pushing to Git returning Error Code 403 fatal: HTTP request failed](https://stackoverflow.com/questions/7438313/pushing-to-git-returning-error-code-403-fatal-http-request-failed) – qurquru Feb 24 '21 at 15:39
  • yeah sorry i tried what they recommended in the accepted answer but it just returned the error that i have added into the original question – some_user_3 Feb 24 '21 at 16:20
  • would it be worth uninstalling and re-installing git-bash? – some_user_3 Feb 24 '21 at 16:21

1 Answers1

1

The problem is that I had the wrong credentials saved on the credential manager.

Once I had removed my old credentials using the Manage Windows Credentials, I was able to add the new ones during the push.

Here is where I found the solution: How to remove git account from local machine and add new account

some_user_3
  • 403
  • 1
  • 5
  • 17