欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

git clone 报错处理和submodule子模块的添加

程序员文章站 2024-02-27 14:03:15
...

git clone 报错

error message:
fatal: unable to access 'https://github.com/xxx.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.

问题:代理设置有错,为 http 错误配置了 https 的代理,导致出错。

解决方法
如果没有配置代理,用以下命令取消代理:

git config --global  --unset https.https://github.com.proxy
git config --global  --unset http.https://github.com.proxy

如果需要使用代理 ,使用 8080 端口为例:

  1. http 协议通过以下命令配置
git config --global http.https://github.com.proxy http://127.0.0.1:8080
git config --global https.https://github.com.proxy https://127.0.0.1:8080
  1. socket 协议通过以下命令配置
git config --global http.proxy 'socks5://127.0.0.1:8080'
git config --global https.proxy 'socks5://127.0.0.1:8080'

子模块添加

如果Git repository里有submodule,那么git clone xxx 之后发现子模块并没有被添加,只存在一个directory,但是里面没有东西。

步骤

  1. Issue a git clone command on the parent repository.
  2. Issue a git submodule init command.
  3. Issue a git submodule update command.
git clone https://github.com/xxx
cd to the dictory
git submodule init
git submodule update
相关标签: 工程