1. 程式人生 > >centos git服務器搭建配置

centos git服務器搭建配置

mkdir cati con 服務 pen upa conf ext pad

安裝git
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel $ yum install git

創建用戶
$ groupadd git
$ adduser git -g git

設置權限
$ cd /home/git/
$ mkdir .ssh
$ chmod 700 .ssh
$ touch .ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys

$ cd /home
$ mkdir gitrepo
$ chown git:git gitrepo/
$ cd gitrepo

$ git init --bare hello.git
Initialized empty Git repository in /home/gitrepo/hello.git/

$ chown -R git:git hello.git

$ git clone [email protected].168.0.218:/home/gitrepo/hello.git


 
配置ssh免密碼登錄
/etc/ssh/sshd_config
  找到以下內容,並去掉註釋符”#“
  RSAAuthentication yes
  PubkeyAuthentication yes
  AuthorizedKeysFile .ssh/authorized_keys 重啟ssh ssh-keygen -t rsa 把公鑰放到服務器中 ~/.ssh/authorized_keys

centos git服務器搭建配置