Git服务器搭建

1.1.1 Git服务器搭建

Git服务器可以搭建在windows,也可以搭建在Linux中,由于windows中copssh登录git服务器软件已经收费,免费版本有很多缺点。因此把git服务器搭建在Linux中。

 

1.1.2 依赖环境

Git需要很多依赖环境:因此安装git需要先安装下列软件:

[[email protected] ~]# yum installcurl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-develgcc-c++

 

1.1.3 安装git

上传git安装包:

安装包:git-2.9.3.tar.gz

tar -xvf git-2.9.3.tar.gz

安装命令:(进入git解压目录)

[[email protected] git-2.9.3]#make prefix=/usr/local all

[[email protected] git-2.9.3]#make prefix=/usr/local install

 

1.1.4 创建git用户

添加Linux的用户,用户名为git的用户:

[[email protected] ~]# useradd git

 

设置git用户的密码

[[email protected] ~]# passwd git

 

输入密码:git

 

切换到git用户

[[email protected] ~]# su - git

 

1.1.5 初始化仓库

初始化仓库,仓库名为taotao.git:

[[email protected] root]$ cd

[[email protected] ~]$ git init--bare taotao.git

始化空的 Git 仓库于 /home/git/taotao.git/

 

 

 

1.2 第二步:开启版本控制

 Git服务器搭建 

Git服务器搭建

1.3 第三步:添加关联

Git服务器搭建

1.4 第四步:添加忽略文件

Git服务器搭建

手动忽略麻烦,可以使用.igore插件

 

具体操作:参考附件:

Git服务器搭建

1.5 第五步:提交到本地

Git服务器搭建

1.6 第六步:推送到远程服务器

Git服务器搭建

 Git服务器搭建

其中:URL:

 

ssh://[email protected]:/home/git/taotao.git

 Git服务器搭建

填入密码:

Git服务器搭建

提交OK。

 Git服务器搭建

 Git服务器搭建

提示提交成功。