Git使用常见问题解决方法汇总

1.      在Ubuntu下使用$ git clone时出现server certificate verification failed. CAfile:/etc/ssl/certs/ca-certificates.crt CRLfile: none

解决方法:在执行$ git clone 之前,在终端输入:

export GIT_SSL_NO_VERIFY=1

2.      在Windows上更新了git 2.6.3 64bit后,clone时出现,unable to negotiate with 10.0.0.8: no matching key exchange methodfound. Their offer: diffie-hellman-group1-sha1

解决方法:在执行git clone之前,在终端输入:

export GIT_SSH_COMMAND='ssh -o KexAlgorithms=+diffie-hellman-group1-sha1'

这种方法每次新开git窗口,都需要重新输入export GIT_SSH_COMMAND

网上有说是因为客户端和服务器端git版本不一致导致的,也有说如果知道服务器ip,可以在C:\Users\Spring\.ssh下新建一个config文件,添加内容如下,但是好像不起作用:

Host 10.0.0.8
	KexAlgorithms +diffie-hellman-group1-sha1

还有一种方法就是,打开.bashrc文件,在终端输入:$ vim ~/.bashrc  ,然后向.bashrc文件写入:

export GIT_SSH_COMMAND='ssh -o KexAlgorithms=+diffie-hellman-group1-sha1'

保存并关闭。这样就不需要每次打开终端时都重新输入export GIT_SSH_COMMAND了。

还有一种方法就是在/etc/ssh/ssh_config文件的最后一行加入:

KexAlgorithms +diffie-hellman-group1-sha1

3.      在Windows上,使用git bash here,编译vs2013工程时,中文显示乱码

解决方法:打开git bash here,鼠标点击右键--> Options… --> Text --> Locale 选择zh_CN,Characterset 选择GBK,点击Apply,OK即可

4.      在Windows上写的代码移到Linux上提交时,会提示DOS line ending (CRLF) found, use Unix line ending (LF) instead

解决方法:(1)、下载dos2unix,执行

sudo apt-get install dos2unit

(2)、对有问题的文件执行:

dos2unit ../xxx.cpp

 

 

 

你可能感兴趣的:(Git/SVN)