0

I have two github accounts, one that I use for personal projects, and another that I use for work, just like the person in this question.

In this scenario, I am trying to push to something using my personal project account, and it's not letting me.

I have set the local name and email to be my person project account (the global is my work project account) using the instructions in the answer to that question, but when I push it denies permission to my global account, not the local account (without even giving me the chance to type in a password for my personal project account).

How can I have some projects push with my personal project account credentials, and other projects push with my work account credentials?

EDIT: The specific command I am getting the error on is git push --set-upstream origin tail_recognition

What I get back is remote: Permission to Repo.git denied to WorkUsername.

When I do git config user.name I get back my personal username, and when I do git config user.email I get back the email for my person username. So why don't I get a chance to sign in with my personal username, and why isn't permission denied to my personal username?

EDIT: I noticed something weird: When I do git config --global user.name I don't get the name that the permission is being denied to, so I'm not sure what's up with that.

Pro Q
  • 4,391
  • 4
  • 43
  • 92

2 Answers2

0

To set a username for a single repository, you need to call the following command: git config user.name "YOUR USER NAME". You can check that it has been set correctly by calling git config user.name. If this still doesn't work, you can try deleting your credentials from 'Credential Manager'(on Windows) and resetting your credentials.

Pritam Sangani
  • 271
  • 1
  • 15
0

You can define a username and email for every project. You can add that to your .git/config file or use git config user.name "Your name". In Git you have two ways. With the option --global you define the global username options. When you remove that option it's the config for the actual project you're in.

Here is the way in the Github documentation:

https://help.github.com/articles/setting-your-username-in-git/

René Höhle
  • 26,716
  • 22
  • 73
  • 82