1

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?

4

1 回答 1

0

问题是因为对于公共存储库,您需要稍微更改您的工作流程。您的朋友将需要分叉您的存储库,并且使用此存储库,他们可以根据需要进行任何更改。

之后,当您准备好合并您的工作时,您的朋友将需要创建一个“拉取请求”,您可以在其中查看代码并决定将更改接受到您自己的存储库中。这是公共协作的 Github 模型。

或者,您可以进入存储库的“设置”,并将您的朋友添加为协作者。然后他应该能够直接将更改提交到您的存储库。

于 2014-10-28T00:42:23.203 回答