2

I Need to clone a GIT repository into remote server via SSH. I have tried doing this in the traditional way, using

git clone git@github.xyz.com:username/repository.git

The above gave me

fatal: Could not read from remote repository.

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

1)Repo exists, I created the repo for test purpose 2)it's a public repo.

Raghu
  • 33
  • 6
  • 2
    If it's a public repo why hide its URL? – phd Dec 10 '19 at 22:30
  • Sounds like you might need to add an SSH key to https://github.com/settings/ssh – zrrbite Dec 10 '19 at 23:53
  • Most likely it sounds like a SSH keys issue. Just in case, be sure you can reach github from your remote server. Here they managed to solve something pretty similar: https://stackoverflow.com/questions/30068298/git-fatal-could-not-read-from-remote-repository-please-make-sure-you-have-th/40049051 – nnimis Dec 11 '19 at 05:28

1 Answers1

1

First, if it is a public repository, you should be able to clone it through https URL

git clone https://github.xyz.com/username/repository.git

Second, to know more about why your SSH URL fails, set GIT_SSH_COMMAND to ssh -v.
Then clone again, and check the error messages.

A ssh -Tv git@github.xyz.com should print your name. If not, as commented, you need to register your ~/.ssh/id_rsa.pub public SSH key to your profile on github.xyz.com.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250