安装和使用git遇到的问题总结

一,centos7下安装(因为centos7下用yum安装git的版本太低了,所以只能下载源代码,然后用源代码安装)

下载编译工具 

yum -y groupinstall "Development Tools"

下载依赖包 
yum -y install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel

下载 Git 最新版本的源代码 
wget https://www.kernel.org/pub/software/scm/git/git-2.13.3.tar.gz

4.解压 

tar -zxvf git-2.11.0.tar.gz

5、进入目录配置 

cd git-2.13.3

./configure --prefix=/usr/local/git

6.安装 

make && make install

7.配置全局路径 

export PATH="/usr/local/git/bin:$PATH"

source /etc/profile

8.查看git版本 

git --version

 

二,遇到的问题

问题1,

 

git push -u origin master  

提示错误:Unable to find remote helper for 'https'

 

解决办法:

1,rm -rf /usr/local/git/(自己机器上的GIT安装目录)

2,yum install curl-devel

3,重新安装git

 

问题2,ubuntu下连不上github的问题

ssh -v git@github.com

上面的命令执行后,一直挺在下面的语句

Connecting to ssh.github.com [192.30.253.123] port 22.

 

解决办法:

1,sudo gedit /etc/hosts

添加下面的2行内容

192.30.255.112 github.com git

185.31.16.184 github.global.ssl.fastly.net

2,编辑后,你需要重新启动一下你的网络。

/etc/init.d/networking restart

3,在~/.ssh目录下创建config文件,输入如下内容:

Host github.com
User xxx@163.com (你注册github时的邮箱,这里使用注册的用户名也行)
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

 

posted @ 2018-06-03 10:53  小石王  阅读(260)  评论(0编辑  收藏  举报