I already have a github account and using it without a problem using gitbash -clone/pull/push. Now I currently created another github account to work with a friend and realized I couldn't push due to account conflict or whatever it is called. So I created a new ssh key and went through a few threads but still didn't get it working but I am able to authenticate between two different git accounts but now I couldn't push or clone due to access rights.
I don't remember the exact all steps I did because I was going through different threads and trying different things. By the way I'm using windows.
1st
I went to the /.ssh
and changed my previous id_rsa
and id_rsa.pub
into id_rsa_acc1
and id_rsa_acc2
2nd
I created another key using
ssh-keygen -t rsa -C "email@email.com"
my previous ssh uses the same email too
3rd
I went to the /.ssh
and changed my new id_rsa
and id_rsa.pub
into id_rsa_acc2
and id_rsa_acc2
4th
in .ssh
folder I created a file called config
and added
# acc1 GitHub
Host acc1 .github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_acc1
# acc2 GitHub
Host acc2.github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_acc2
5th
I login into github.com with my acc2 and added the ssh key in /.ssh/id_rsa_acc2.pub
into github settings>SSH keys
6th
eval `ssh-agent -s`
ssh-add
7th
ssh-add ~/.ssh/id_rsa_acc1
ssh-add ~/.ssh/id_rsa_acc2
8th
ssh -T git@acc1.github.com
Hi acc1! You've successfully authenticated, but GitHub does not provide shell access.
ssh -T git@acc2.github.com
Hi acc2! You've successfully authenticated, but GitHub does not provide shell access.
I couldn't find one of the error messages anymore but when I tried to push into the acc2 it said something about denying access because of acc1 or something like that. Then I tried using clone by ssh url and couldn't even clone any of these two accounts from github.
Now when I try to clone/push/pull I only get such error message Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Can someone please give me a hand?