github拉代码出现Permission denied (publickey).等问题的解决

这几天,调试串口需要使用到git hub开源的android-serialport-api网址为https://github.com/cepr/android-serialport-api

再使用github拉取代码,将遇到到问题记录,方便自己以后查阅。

1 使用https

git clone https://github.com/cepr/android-serialport-api.git
出现问题如下

ubuntu:/work2/opt/test$ git clone https://github.com/cepr/android-serialport-api.git
Cloning into 'android-serialport-api'...
error: gnutls_handshake() failed: A TLS packet with unexpected length was received. while accessing https://github.com/cepr/android-serialport-api.git/info/refs
fatal: HTTP request failed
解决方法

出现这类错误,一般是因为自己的机器没有联网导致,连上网之后,就可以git clone。

2 使用ssh

git clone git@github.com:cepr/android-serialport-api.git

出现问题如下

ubuntu:/work2/opt/test$ git clone git@github.com:cepr/android-serialport-api.git
Cloning into 'android-serialport-api'...
Write failed: Connection reset by peer
fatal: The remote end hung up unexpectedly
原因:没有上传public key或者上传的public key过期
解决办法:上传public key

(1)查看自己机器的public key

cat ~/.ssh/id_rsa.pub

cat后出出现一堆字符串

(2)登录github,点击github的右上角 View profile and more


(3)点击SSH and GPG keys,然后点击右上角的New SSH key,将1步骤的一大堆字符串拷贝进去就可以了


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值