1

I have 2 GitHub accounts:

account1

account2

In account2 I'm added as collaborator of a certain repo:

account_notmine/repo_xyz

I've created and added a new ssh key for the second account, and also added it on github.

Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa

Host github-new
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_new

Now, if I try to work on one of my personal repositories of account2, it works fine. But when I try to clone the repo of which I'm a collaborator, it doesn't work.

Basically, all that I'm doing is trying to execute this command:

git clone --bare git@github-new:account_notmine/repo_xyz.git

And the error it gives me is:

Cloning into bare repository 'repo_xyz.git'...
Warning: Permanently added 'github.com,xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What am I doing wrong?

2 Answers2

0

I had this problem too in the past where I tried to solve:

ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

I've been told that the most common reason of this happening is because of spelling mistakes in the repository name (case-sensitive), does the repo really exists? It could also be bad permissions to view the repo or in rare circumstances, bad SSH access-settings to a repository.

I found the answer here GitHub: ERROR: Repository not found. fatal: The remote end hung up unexpectedly (different from similar posts apparently).

I hope it's helpful in some way.. :)

Community
  • 1
  • 1
Answer_Bot
  • 35
  • 3
  • I copied and pasted the repository name (double-checking many times), so it is not a mispelling issue. I'll try to investigate the other possibilities. Thank you. – Enrico Morandin Apr 26 '15 at 10:19
0

Solved: just by calling my github second account via SSH (ssh -T git@github-new), I discovered that it answered me:

Hi **account1**! You've successfully authenticated, but GitHub does not
# provide shell access.

Then I edited my ssh config file adding the IdentitiesOnly yes statement:

Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes

Host github-smartstay
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_new
  IdentitiesOnly yes

Well, it worked.