这几天,调试串口需要使用到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步骤的一大堆字符串拷贝进去就可以了