问题目录
问题1:fatal: Could not read from remote repository.
在服务器上运行 git clone xxxxx 下载程序时会报如下错误:
Warning: Permanently added ‘github.com,xx.xxx.xxx.xx’ (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
原因分析:
在GitHub中上传代码需要设置公钥,如果设置则可能是当前操作用户与GitHub中存储公钥不匹配。
解决方案:
- 首先查看自己是否有公钥。运行指令
cat ~/.ssh/id_rsa.pub
如果有公钥则会看到一大段字符串:ssh-rsa…,这就是所谓的publickey;但是如果提示报错的话则说明没有公钥,此时你应当自己创建一个公钥,输入
ssh-keygen
然后一直回车就行,最后会生成一个矩形框框一样的东西,就说明公钥已经生成。
此时再运行指令
cat ~/.ssh/id_rsa.pub
就会看到那一大段字符串,就是publickey。
- 复制公钥。从ssh-rea开始一直到末尾xxx@xxxxxx前,选中,右键copy复制。
- 登录GitHub,点击右上角头像 –> settings –> SSH and GPG keys –> new SSH key –> title自己取名,key中粘贴publickey –> Add SSH key –> 成功.
- 再次运行代码 git clone xxxxxxxxxxxx. 成功运行。
参考链接:
问题2:ERROR: Command errored out with exit status 128: git clone -q
在服务器上运行 git clone https://xxxxx 下载程序时会报如下错误:
fatal: unable to access 'https://github.com/cocodataset/cocoapi.git/': GnuTLS recv error (-9): A TLS packet with unexpected length was received. WARNING: Discarding git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI. Command errored out with exit status 128: git clone -q https://github.com/cocodataset/cocoapi.git /tmp/pip-req-build-o_aocosg Check the logs for full command output. ERROR: Command errored out with exit status 128: git clone -q https://github.com/cocodataset/cocoapi.git /tmp/pip-req-build-o_aocosg Check the logs for full command output.解决方案:
1. 可以尝试将命令行里的http改为git后重新执行。
2. 可以尝试执行以下代码:
git config --global http.postBuffer 2000000000
参考链接:
问题3:error: RPC failed; result=35, HTTP code = 0
error: RPC failed; result=35, HTTP code = 0
fatal: The remote end hung up unexpectedly
解决方案:
将 git clone https://github.com/***** 改为 git clone git://www.github.com/***** 。
参考链接:
问题4:gnutls_handshake() failed: The TLS connection was non-properly terminated
fatal: unable to access ‘https://github.com/aim-uofa/AdelaiDet.git/’: gnutls_handshake() failed: The TLS connection was non-properly terminated.
解决方法:
将 git clone https://github.com/***** 改为 git clone git://github.com/*****