Git troubleshooting

使用GIT的时候,因为network环境问题,经常会遇到一些莫名的错误。
这里给出几个帮助你troubleshooting的小技巧。

1. troubleshooting curl
GIT_CURL_VERBOSE=1

如果是通过https来连接,git默认是用curl来upload/download的。设定这个环境变量,会让你便于查看到底curl遇到了什么问题。

2. troubleshooting ssh
ssh -vT [email protected]

如果是通过ssh来连接的并遇到问题了,那么先用这个命令来检查一下ssh遇到了什么问题。
可以通过增加v的个数来看到更多的debug输出,例如
ssh -vvvT [email protected]

就会给出debug 3级别的输出。

另外,如果ssh证明书是自己发行的,那么设定下面的环境变量,可以解决ssh证明书确认错误。
GIT_SSL_NO_VERIFY=true


3. troubleshooting git
GIT_TRACE=2 git push

通过设定GIT_TRACE变量,可以查看git命令的执行trace。

得到了debug输出后,如果仍不能解决,就直接google search好了。\o/

猜你喜欢

转载自tetsu.iteye.com/blog/1508372