centos下搭建git服务器
2017-01-11 15:23
295 查看
1.安装GIT
如果没有执行chown更改文件归属
打开文件
创建authorized_keys文件 并将客户端密钥输入到文件中 保存退出
注意:authorized_keys归属root
[root@localhost ~]# ll /home/git/.ssh/
total 4
-rw-r--r--. 1 root root 398 Jan 14 17:07 authorized_keys
7.客户端使用
常见问题:
1.not a valid object name master
使用Git来管理代码,第一次远程分支上什么都没,也没有本地分支。想建新的分支也没用。提示:not
a valid object name master,查了下资料需要先添加点东西。所以在本地git库中新增了一个文件,然后在git命令行中敲入git commit
2.已经添加客户端key但是还是让输入密码
1)authorized_keys文件归属不对,归属root用户下,即:
[root@localhost ~]# mkdir /home/git/.ssh
[root@localhost .ssh]# vim authorized_keys
[root@localhost .ssh]# cat ../id_rsa.pub >> authorized_keys
参考:
1.http://www.cnblogs.com/lovychen/p/5900688.html
2.http://blog.csdn.net/hustpzb/article/details/8230454/
3.http://blog.csdn.net/wave_1102/article/details/47779401
4.http://blog.csdn.net/spring123tt/article/details/49867359
[root@localhost ~]# yum install -y git2.创建git帐号
[root@localhost ~]# useradd git [root@localhost ~]# passwd git
[root@localhost yjx2]# su git3.创建git仓库
[git@localhost ~]$ git init --bare learngit.git注意:在git用户下创建learngit.git 文件归属git
如果没有执行chown更改文件归属
[root@localhost git]# chown git:git learngit.git4.客户端创建生成密钥ssh key
[yjx@localhost ~]$git config --global user.name "jingsia"
[yjx@localhost ~]$git config --global user.email "xxx@xx.com"
[yjx@localhost ~]$ssh-keygen -t rsa -C "xxx@xx.com"这里会生成 id_rsa 和 id_rsa.pub 一个是私有密钥 一个是公有密钥
[yjx@localhost ~]$ ls .ssh/id_rsa* .ssh/id_rsa .ssh/id_rsa.pub5.git服务器打开RSA认证
打开文件
[root@localhost ~]# vim /etc/ssh/sshd_config设置
RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys6.git服务器添加客户端密钥
创建authorized_keys文件 并将客户端密钥输入到文件中 保存退出
[root@localhost ~]$ touch .ssh/authorized_keys
注意:authorized_keys归属root
[root@localhost ~]# ll /home/git/.ssh/
total 4
-rw-r--r--. 1 root root 398 Jan 14 17:07 authorized_keys
7.客户端使用
git clone git@192.190.71.99:/home/git/learngit.git
常见问题:
1.not a valid object name master
使用Git来管理代码,第一次远程分支上什么都没,也没有本地分支。想建新的分支也没用。提示:not
a valid object name master,查了下资料需要先添加点东西。所以在本地git库中新增了一个文件,然后在git命令行中敲入git commit
2.已经添加客户端key但是还是让输入密码
1)authorized_keys文件归属不对,归属root用户下,即:
[root@localhost ~]# mkdir /home/git/.ssh
[root@localhost .ssh]# vim authorized_keys
[root@localhost .ssh]# cat ../id_rsa.pub >> authorized_keys
参考:
1.http://www.cnblogs.com/lovychen/p/5900688.html
2.http://blog.csdn.net/hustpzb/article/details/8230454/
3.http://blog.csdn.net/wave_1102/article/details/47779401
4.http://blog.csdn.net/spring123tt/article/details/49867359
相关文章推荐
- CentOS下搭建Git服务器Gitosis1
- 搭建GIT服务器(CentOS)
- 在CentOS6.2下搭建git服务器gitosis
- CentOS 6.5下GIT服务器、gitweb搭建
- CentOS搭建GIT服务器【一】-仓库搭建以及基于gitosis的SSH方式访问
- CentOs上搭建git服务器
- CentOS 6.4 搭建git 服务器
- 【CentOS】搭建git服务器
- centos 搭建简单git服务器
- CentOS 6.5下Git服务器搭建
- CentOs上搭建git服务器
- CentOS下搭建Git服务器Gitosis[教程]
- CentOs上搭建git服务器
- CentOS 6.4 搭建git 服务器
- CentOS下搭建Git服务器Gitosis
- CentOS下搭建Git服务器Gitosis
- 在centos上搭建git服务器
- CentOs上搭建git服务器
- CentOS搭建GIT服务器【二】-HTTP源码访问及smart http协议
- CentOS 6.4 搭建git 服务器