Gitolite伺服器搭建配置

來源:互聯網
上載者:User

標籤:git   營運   gitolite   代碼   


最近開發說需要搭建一個git伺服器來用,就順便學了下,也記下來方便以後參考

安裝GIT


## 安裝依賴包

yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel


## 安裝libiconv依賴包

wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gztar -xf libiconv-1.14.tar.gz cd libiconv-1.14./configure --prefix=/usr/local/libiconvmake make install


## 添加使用者

groupadd gituseradd -g git git


## 下載最新版本並安裝

wget https://github.com/git/git/archive/master.zipunzip master.zipcd git-mastermake configure./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconvmake make install

* 當然,上面的操作也可以用官網的方法,不過安裝的便不是最新的版本,而是系統適配的版本

yum install git


## 查看版本

[[email protected]_home ]# git --versiongit version 2.1.0-rc0


* 如果能正常看到版本號碼,說明你安裝Git成功了.接下來安裝gitolite



## gitolite 的安裝就比較簡單了,登陸到 git賬戶,或是su到git賬戶後繼續操作

su - git


## 產生一對測試用的key,或是用已有的key測試下

[[email protected] git]# mkdir /home/git/.ssh[[email protected] git]# chmod 700 /home/git/.ssh[[email protected] git]# cd /home/git/.ssh[[email protected] git]# ssh-keygen -b 1024 -t rsa -f jobGenerating public/private rsa key pair.Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in job.Your public key has been saved in job.pub.The key fingerprint is:bb:90:6e:37:75:3a:6d:f5:81:eb:e4:7b:36:31:69:41 [email protected]The key‘s randomart image is:+--[ RSA 1024]----+|                 ||               E ||              .  ||               . ||        S     . o||       . .. ...* ||      o .. + oo.+||     ...o.o =. +.||     ..... o.++ .|+-----------------+[[email protected]_home git]# ls .ssh/job  job.pub


## 開始安裝gitolite

cd /home/gitgit clone git://github.com/sitaramc/gitolitemkdir -p /home/git/bin/home/git/gitolite/install -to /home/git/binln -s /home/git/bin/gitolite /usr/bin/gitolite gitolite setup -pk .ssh/job.pub

* 執行完最後一步後,git會產生以下檔案夾,其中gitolite-admin.git 便是許可權管理庫

/.gitolite./repositories./repositories/gitolite-admin.git./repositories/testing.git


* 好吧,到了這一步,其實gitolite的管理端就完成了,

  接下來要做的就是怎麼從用戶端更改git許可權庫呢。



#####  從客戶機系統管理權限庫,最好是利用不同的機器,且機器上已經安裝了git環境,如果沒安裝,就參照第一部分進行安裝

##預設22連接埠的串連git clone [email protected]:gitolite-admin##特別指定連接埠的串連git clone ssh://[email protected]:22/gitolite-admin


## 完成後會在命令執行目錄看到gitolite-admin庫,裡面的結構如下

 

./gitolite-admin/.git./gitolite-admin/keydir./gitolite-admin/keydir/job.pub./gitolite-admin/conf./gitolite-admin/conf/gitolite.conf


## 其中keydir就是存放公開金鑰的地方,新家公開金鑰只要添加到這裡,gitolite.conf就是庫的設定檔,也是可以限制許可權的地方,內容類別似

repo gitolite-admin    RW+     =   jobrepo testing    RW+     =   @all



更多的內容參考下面檔案,gitolite的安裝配置

http://roclinux.cn/?p=2553

http://git-scm.com/book/zh/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-Gitolite











本文出自 “納米龍” 部落格,請務必保留此出處http://arlen.blog.51cto.com/7175583/1536066

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.