> 技术文档 > 痛心疾首!告别腾讯云服务器git pull拉取github经常出现网络错误问题Empty reply from server_git empty reply from server

痛心疾首!告别腾讯云服务器git pull拉取github经常出现网络错误问题Empty reply from server_git empty reply from server


一、遇到问题

使用腾讯云服务器去github拉取代码,经常出现网络错误问题。

fatal: unable to access \'https://github.com/xxx/xxx.git/\': Empty reply from server

二、解决办法

git 使用 ssh 进行连接

1、生成新的 SSH 密钥

cd ~/.ssh/ssh-keygen -t ed25519 -C \"xxxxx@gmail.com\" # 备注你的邮箱

需要输入密码,一路回车即可

2、添加 SSH 密钥到 SSH Agent

eval \"$(ssh-agent -s)\"ssh-add ~/.ssh/id_ed25519

3、将公钥添加到 GitHub

cat ~/.ssh/id_ed25519.pub

复制输出的全部内容,登录 GitHub,前往 Settings > SSH and GPG keys > New SSH key

Title:随便写一个名字

Key type:保持默认
Key:粘贴刚才复制的内容

4、测试连接

ssh -T git@github.com

如果看到类似下面的消息,说明配置成功!

Hi abc! You’ve successfully authenticated, but GitHub does not provide shell access.

然后删除项目重新用 git@github.com 拉取即可

git clone git@github.com:abc/xxxxxx.git