天天看点

CentOS下Git的服务器版安装和使用

git分布式版本控制系统:

git的使用体验,早已习惯了svn [集中式] 代码管理的吾,第一次接触分布式的git的时候,感觉很难使用,煎熬了一段时间,整个项目组,也是花费了很大的代价,就是出现代码被覆盖很多次,代码都不敢提交了!

记得在中国民航的时候,由于服务器硬件搬家过程中损坏,导致整个系统和代码全部丢失,不是很重要所以没有去做数据恢复,svn就挂了。

记得在金葵花的时候,由于svn服务器端口被抢占,导致没有启动,早上经理不在,没权限,所有,大家闲置了一早上。

使用了一段时间的git,使用过①:tortoisegit和②:eclipse的git插件和③git-2.6.2-64-bit的命令行,前两者是可视化的,我选择的最后的命令行。

CentOS下Git的服务器版安装和使用

git的思想,遵循gnu的思想:gnu是“gnu is not unix”的递归缩写。git继承了开源社区的精神,不直接支持权限控制。但也有脚本接口和第三方管理权限。不过视代码为生命,视员工为窃贼的公司,就感觉没必要用。但可以自己安装gitlab,自己的git服务器。

git和github和gitlab的区别:

gitlab - 基于git的项目管理软件。

github - 一个免费/收费网站,提供给用户空间创建git仓储,保存用户的一些数据文档或者代码等。

gitlab - 是一个用于仓库管理系统的开源项目。使用git作为代码管理工具,并在此基础上搭建起来的web服务。

git

-- 分布式版本控制系统通常也有一台充当“中央服务器”的电脑,但这个服务器的作用仅仅是用来方便“交换”大家的修改,没有它大家也一样干活,只是交换修改不方便而已。

闲话不说,开始搭建自己的git服务器:

系统:#cat /etc/issue  --> centos release 6.5 (final)和 #git --version --> git version 1.7.1

1:安装git:

2:搭建服务器:

3:遇到错误:

错误1:

$ git clone [email protected]:/home/repository/git/kekeai.git

cloning into 'kekeai'...

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@    warning: remote host identification has changed!     @

it is possible that someone is doing something nasty!

someone could be eavesdropping on you right now (man-in-the-middle attack)!

it is also possible that a host key has just been changed.

the fingerprint for the rsa key sent by the remote host is

sha256:ohpau2z3pkmfjyco3f/yb3slbevz8ilp7ig4cecm624.

please contact your system administrator.

add correct host key in /c/users/tony_tian/.ssh/known_hosts to get rid of this message.

offending rsa key in /c/users/tony_tian/.ssh/known_hosts:2

rsa host key for 123.12.188.057 has changed and you have requested strict checking.

host key verification failed.

fatal: could not read from remote repository.

please make sure you have the correct access rights

and the repository exists.

解决 1:

删除自己本地[windows]的c:\users\tony\.ssh下known_hosts文件下,删除,对应当前”123.12.188.057“这个服务器的:

123.12.188.057 ssh-rsa ……这一行!

问题2:

git在clone时候权限要输入密码:

the authenticity of host '123.12.188.057 (123.12.188.057)' can't be established.

rsa key fingerprint is sha256:ohpau2z3pkmfjyco3f/yb3slbevz8ilp7ig4cecm624.

are you sure you want to continue connecting (yes/no)? yes

warning: permanently added '123.12.188.057' (rsa) to the list of known hosts.

[email protected]'s password:

解决2:

1:查看用户的公钥位置是否在,git或其他用户的那个指定的目录下,"公钥文件路径错误",请查看!

2:如果不是root,则查看,文件的权限问题!

3:查看本地的id_rsa.pub的内容,是否告诉服务器的,authorized_keys。

4:删除本地known_hosts中,当前服务器的配置,重新开启一个git命令行,clone就好!

备注:ubuntu下安装的,gitweb和git的安装包:

<a target="_blank" href="http://www.liaoxuefeng.com/">廖雪峰的</a>

继续阅读