git报错 ssh: connect to host gitla

2019-04-22  本文已影响0人  骑马纵天下

拉取代码报错:

leon:317hu_iOS huanghaipo$ git pull
ssh: connect to host gitlab.317hu.com port 22: Operation timed out
fatal: Could not read from remote repository.

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

解决办法:

  1. 将原先的.ssh中的文件删除


    .ssh
  2. 生成新的.ssh文件
leon:~ huanghaipo$ ssh-keygen -t rsa -C "huanghp@317hu.com(自己的账号名)"

中途会让输入密码

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/huanghaipo/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/huanghaipo/.ssh/id_rsa.
Your public key has been saved in /Users/huanghaipo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA56:vL7UVl78DeXYWbukUCxdjbKHtYPfEXwTBbXcPj6I huanghp@317hu.com
The key's randomart image is:
+---[RSA 2048]----+
|           . oo+.|
|          o * =.=|
|         o * % BB|
|       .. . @.*=O|
|        S  o.o==+|
|         oEo..ooo|
|        o o .. .o|
|       o .       |
|        o.       |
+----[SHA256]-----+
  1. 输入命令查看公钥。
cat ~/.ssh/id_rsa.pub
查看公钥

4.将公钥复制到gitlab设置SSH Keys选项
将原来的删除,添加新的。


SSH Keys
上一篇 下一篇

猜你喜欢

热点阅读