I have a work GitHub account and a personal one. First I used the personal one for test projects, then I moved on and did a repository with the other account on the same com
Never had any problems with git till at work they recently connected our macbooks to Active Directory & added a few admin accounts to my machine. However, after that git would work fine till i locked my screen and came back. Then I would get a vague error similar to
No user exists for uid 1927040837
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I only have one ssh key on this particular machine for my user and am using zsh in my term. The user email and name were correct so that wasn't the issue. Ergo, restarting after every time i lock my machine is futile. The solution for me was to edit my .zshrc
file and uncomment the line that exports the ssh-key (which i've never had to do before and have been using zsh for years).
The line should look something like this:
# ssh
export SSH_KEY_PATH="~/.ssh/<your_rsa_id>"
Once you do this just run a reset
in terminal and everything works fine.
I hope this helps someone else.
I ran into this problem as well and none of the above solutions worked even after I deleted my ssh key and made a new one. Turns out ssh-agent was using a cached key, so I had to run killall ssh-agent
and then it worked.
Found the solution here. http://fzysqr.com/2012/08/28/quick-tip-wrong-ssh-key-cached-with-github-after-changing-users-and-keys/
github identifies you by the ssh key it sees, not by any setting from git.
Therefore, you need to ensure that your work account's ssh key is not in your keyring when you try to push as your personal account and vice versa. Use ssh-add -l
to determine which keys are in your keyring, and ssh-add -d keyfile
to remove a key from your keyring.
Also, you may need to check ~/.ssh/config
if you have configured it to present certain ssh keys to github. Finally, I don't know how github deals with two accounts having the same ssh public key, so make sure you don't do that.
I had this problem as well but none of the other solutions worked for me. It turns out that for work we had created a .netrc
file that had entries for github authentication. The git
command always used the .netrc
, which had my old user name and password. I had to edit the entries in my .netrc
file to use the new username and password.
Go to Control Panel > User Accounts > Credential Manager > Generic Credentials
remove the git credentials. Then run git push. This will prompt to ask for the git credentials. Enter your correct credentials.
If changing the SSH key associated with the account doesn't work, change the email associated with the account.
Go to Github > Account Settings > Emails and verify the email address you are using to commit matches the email on the account.
To see what email address you're using to commit, run the following command: git config --global user.email
. If you need to change the email address that you are using to commit, run git config --global user.email "your_email@youremail.com"
.