简体   繁体   中英

How to clone git repo using private key

I have read a few questions and answers on here regarding using ssh to clone a git repo, but none have worked for my scenario.

My setup includes a server with a private git repo that I can pull from locally by running git pull . I have a git config file on my local machine that tells it where to pull from. It's been set up like this for a long time.

I now need to pull from that same repo from a different server. I have the same exact .git/config on the new server as I do my local.

When I run git pull on the new server, I want it to grab files from the current prod git repo just like my local machine does, but it gives me the error:

ssh: connect to host mysite.com port 22: Connection refused fatal: Could not read from remote repository.

I would greatly appreciate any help in fixing this.

Thanks for your time.

the following error

ssh: connect to host mysite.com port 22: Connection refused

indicates that the ssh-server on the host mysite.com is not reachable on port 22.

here's a number of ideas why:

  • there is no ssh-server running at all
  • there is an ssh-server running but a firewall is blocking access
  • there is an ssh-server running but it is listening on a non-standard port
  • you have accidentally mistyped the server-name (or the server-name is resolved to the wrong IP)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM