基於CentOS7 2的GIT伺服器簡易搭建和使用

2021-08-20 06:05:50 字數 1382 閱讀 7643

git使用你的ssh帳戶登入。也就是說,他的檔案許可權和你的ssh帳戶許可權是一致的。

客戶端就不說了,安裝git 即可。

windows平台還建議安裝tortoisegit配合。

服務端:

yum install git
安裝後,已經可以進行倉庫的建立。

其實就git來說,不嚴格區分服務端客戶端。

1) 服務端建立bare型別的目錄

cd /opt/code

#建議目錄名建立成***.git

mkdir hello.git

cd hello.git/

git init --bare -- shared

2)客戶端簽出

git clone [email protected]

:/opt/code/hello.git

簽出完成後,可以放入需要的檔案,進行上傳操作

3) 選擇」git commit」

此時提交的是本地,還未同步到伺服器

4)同步到伺服器

選擇「git sync」,「push」即可。

yum install gitweb httpd
i.修改/etc/gitweb.conf

追加以下

$projectroot = "/opt/code";
即會在頁面中展現該目錄下所有的git倉庫(包括子目錄)。

ii. 修改 /etc/httpd/conf/httpd.conf檔案。

在尾部追加

servername

gitserver

documentroot

/var/www/git

options

+execcgi +followsymlinks +symlinksifownermatch

allowoverride

allorder

allow,deny

allow

from all

addhandler cgi-script cgi

directoryindex gitweb.cgi

★網上的很多資料execcgi前沒有+號,httpd是直接起不來的。

由於我的httpd同時還承載著其他業務,因此可以多個listen,通過虛擬伺服器的過濾規則確定。

listen

80listen

3334

全部配置完後

Centos 7 2安裝git和解除安裝git

可以使用whereis git等命令來檢查是否已經安裝了git版本的 我是用git version檢測到我的環境自帶的git版本是1.7不能滿足條件,所以要先解除安裝低版本的git。使用命令 yum remove git解除安裝git 我搭建的環境有centos6.5和centos7.1兩個,都進行...

centos7 2下編譯安裝git

centos最新的7.2版本,git居然是1.8,而最新的git版本是2.9 差的太多了,何況git2.0後有大更新。於是,我決定編譯安裝。中間有一點小破折,記錄一下,備忘。2,解壓 tar xzvf git 2.9.2.tar.gz 3,進入解壓後的git目錄後,執行 configure很順利。4...

CentOS 7 2 安裝教程

目錄 1.what is centos?介紹 特點 官網 2.download 製作u盤啟動 centos community enterprise operating system,中文意思是社群企業作業系統 是linux發行版之一,它是來自於red hat enterprise linux依照開...