CentOS安裝配置Git伺服器(gitosis)

來源:互聯網
上載者:User

標籤:blog   http   io   ar   os   使用   sp   for   on   

1、安裝git用戶端(為了clone gitosis版本庫)
安裝依賴包:yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
安裝git: yum install git
安裝成功後,可以用git --version查看安裝的git版本號碼
2、安裝gitosis
安裝python工具:yum install python python-setuptools
依次執行:
git clone git://github.com/res0nat0r/gitosis.git
cd gitosis
python setup.py install
#顯示Finished processing dependencies for gitosis==0.2即表示成功

3、開發機上產生公開金鑰和對應的密鑰(我的開發機為win7 64bit)
ps:本步驟的前提是開發機上裝有Git for Windows(http://msysgit.github.io/),並在環境變數path中添加C:\Program Files (x86)\Git\bin。
ssh-keygen -t rsa
按照提示得到一個id_rsa和一個id_rsa.pub(公開金鑰),複製到C:\Program Files (x86)\Git\.ssh目錄中。
4、上傳公開金鑰到伺服器並初始化gitosis
將id_rsa.pub上傳到伺服器/tmp目錄下,並在伺服器上產生git使用者,使用git使用者並初始化gitosis
adduser -m git
su - git
gitosis-init < /tmp/id_rsa.pub
#顯示以上資訊即表示成功
#Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
#Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/

5、clone gitosis-admin.git 管理版本庫
gitosis-admin.git版本庫的作用是可以全域管理所有gitosis下面的子版本庫,因此clone到本地並修改設定檔,再push到伺服器上,就可以實現對其他版本庫的管理,如使用者、許可權等。
在開發機的命令列中執行
git clone ssh://[email protected]伺服器IP:SSH連接埠/gitosis-admin.git
如果能夠正常clone出來gitosis-admin版本庫,基本的配置已經完成。

下面開始建立版本庫
6、編輯新項目許可權
編輯開發機上clone出來的gitosis.conf檔案,在檔案結尾加上:
[group test-git] # 組名稱
writable = test-git # 項目名稱
members = [email protected] #密鑰使用者名稱,參照gitosis-admin組的配置

然後add 、commit並push
git add .
git commit -m ‘add test-git’
git push

7、建立新項目倉庫並提交
在開發機上建立專案檔夾,命令列中cd到該檔案夾,執行下邊命令
git inti
touch readme
git add .
git commit -a -m "init test-git"
git remote add origin ssh://[email protected]伺服器IP:SSH連接埠/test-git.git
git push origin master

以後的每次修改提交就是add commit push這樣的過程,不做累述。

參考文獻:

http://blog.longwin.com.tw/2011/03/linux-gitosis-git-server-2011/

http://www.cnblogs.com/vicowong/archive/2013/05/06/3062397.html

 

CentOS安裝配置Git伺服器(gitosis)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.