Reputation: 86
I have two github accounts. I have created SSH keys for both, and configured them accordingly. I know that my config works because I can push to both accounts for my personal repos fine. Example config
Host github.com
etc
IdentityFile: id_rsa
Host github-second
etc
IdentityFile: id_rsa_second
To add remote for my normal account, I use
git remote add origin [email protected]:account/repo.git
To add remote for the second account, I use
git remote add origin git@github-second:second-account/other-repo.git
I am now a member of an organization with my second account.
The url for the repo of interest looks like github.com/organization/org-repo
vs github.com/second-account/org-repo
.
I have tried to add the org repo using:
git remote add origin git@github-second:organization/org-repo
and I indeed got the repo files on my local machine. However, I cannot push to the org repo.
Error:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.```
I have contacted the organization and they said that I have full write access.
I am not sure what else to try.
Upvotes: 3
Views: 1085
Reputation: 86
I fixed it by:
ssh -T git@github-second
and make sure it is pointed to second-account
git remote add origin git@github-second:second-account/org-repo.git
git remote add upstream git@github-second:org-account/org-repo.git
Upvotes: 1