CentOS搭建Git服務器及權(quán)限管理(gitolite)

CentOS搭建Git服務器及權(quán)限管理

聲明:本教程,僅作為配置的記錄,細節(jié)不展開,需要您有一點linux的命令基礎,僅作為配置參考。

1. 系統(tǒng)環(huán)境

系統(tǒng): Linux:CentOS 7.2 64位

由于CentOS已經(jīng)內(nèi)置了OpenSSH,如果您的系統(tǒng)沒有,請自行安裝。

查看ssh版本

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n7" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ ssh -V

輸出以下表示沒問題,可以繼續(xù)。 版本可能不一致,能用即可。

OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013</pre>

避免系統(tǒng)環(huán)境和其他的不一致,請核對您系統(tǒng)的版本,其他發(fā)行版請對應修改。

2. 安裝git

建議以下操作都切換到root

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n12" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 請確保您切換到了root賬戶
su root yum install -y git

驗證是否安裝成功

$ git --version

輸出如下內(nèi)容表示成功:

git version x.x.x.x</pre>

3. 添加git的管理的賬戶和設置密碼

設置專門管理git的賬號非必須,但是建議這么操作。

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n15" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 添加git賬戶
$ adduser git

修改git的密碼

$ passwd git

然后兩次輸入git的密碼確認后。

查看git是否安裝成功

$ cd /home && ls -al

如果已經(jīng)有了git,那么表示成,參考如下:

drwxr-xr-x. 5 root root 4096 Apr 4 15:03 .
dr-xr-xr-x. 19 root root 4096 Apr 4 15:05 ..
drwx------ 10 git git 4096 Apr 4 00:26 git

默認還給我們分配一個名字叫g(shù)it的組。</pre>

4. git的權(quán)限管理

git倉庫的權(quán)限管理,我們可以手動進行管理和配置,也可以通過其他輔助工具。如果小團隊的話,直接通過ssh公鑰進行管理即可,如果大點的團隊,最好用gitolite 或者 gitosis,兩者都差不多,一個是Perl開發(fā),一個是Python開發(fā)。

以下我分別介紹手動管理權(quán)限和使用gitolite管理的方式,注意兩者不兼容,不能混用。

5. git的手動權(quán)限管理

經(jīng)過以上步驟,其實服務器的基本已經(jīng)配置好,但是需要設置權(quán)限和配置遠程訪問git倉庫的方式。我們只介紹ssh的方式,https不做介紹。

5.1 配置服務端的ssh訪問

切換到git賬號,并創(chuàng)建ssh的默認目錄和校驗公鑰的配置文件

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n23" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 1.切換到git賬號
$ su git

2.進入 git賬戶的主目錄

$ cd /home/git

3.創(chuàng)建.ssh的配置,如果此文件夾已經(jīng)存在請忽略此步。

$ mkdir .ssh

4. 進入剛創(chuàng)建的.ssh目錄并創(chuàng)建authorized_keys文件,此文件存放客戶端遠程訪問的 ssh的公鑰。

cd /home/git/.ssh touch authorized_keys

5. 設置權(quán)限,此步驟不能省略,而且權(quán)限值也不要改,不然會報錯。

chmod 700 /home/git/.ssh/ chmod 600 /home/git/.ssh/authorized_keys</pre>

此時,服務端的配置基本完成。接下需要把客戶端的公鑰拷貝到authorized_keys文件中。

5.2 配置客戶端的ssh私鑰并上傳服務器

以下是客戶端創(chuàng)建ssh私鑰和拷貝的過程,如果您有私鑰越過創(chuàng)建私鑰的過程。

請用您的客戶端進入終端(如果只有一臺電腦,可以用不同的賬號模擬不同客戶端)

第一步: 創(chuàng)建客戶端的ssh私鑰和公鑰

檢查是否已經(jīng)擁有ssh公鑰和私鑰:進入用戶的主目錄。

用戶主目錄: Windows系統(tǒng):C:\Users\用戶名 Linux系統(tǒng):/home/用戶名 Mac系統(tǒng):/Users/用戶名

然后查看是否有.ssh文件夾,此文件夾下是否有如下幾個文件。

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n32" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 用戶主目錄的.ssh文件夾下
.ssh
├── id_rsa
└── id_rsa.pub # 我們要用的私鑰</pre>

如果沒有,那么用ssh-keygen創(chuàng)建ssh的私鑰。

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n34" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ ssh-keygen -t rsa

接下來,三個回車默認即可。</pre>

創(chuàng)建私鑰成功后,在查看用戶目錄是否有意加有了公鑰文件id_rsa.pub

第二步: 拷貝私鑰到git的服務器

如何把客戶端的文件拷貝到服務器端,我建議用scp命令進行拷貝。

以下以mac系統(tǒng)為例:

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n39" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 首先進入我的用戶主目錄的.ssh目錄下,注意用戶名xxx替換成自己的
$ cd /Users/xxx/.ssh

以下命令是:把本地的id_rsa.pub文件拷貝到 aicoder.com服務器,登錄aicoder.com服務的賬號是git。

冒號后面默認就是git賬號的主目錄,最后文件被保存成laoma.pub

注意:把域名換成你自己的或者ip,最后的文件名可以自己定,后面還有用。

$ scp ./id_rsa.pub git@aicoder.com:.ssh/laoma.pub</pre>

5.3 服務器端添加客戶端的SSH公鑰

切換到服務器端,把剛才上傳的laoma.pub文件的內(nèi)容添加到 authorized_keys中,就可以允許客戶端ssh訪問了。

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n42" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 切換到git賬戶
su git cd /home/git/.ssh

$ ls -al

查看一下.ssh目錄是否有authorized_keys和laoma.pub文件

.

|-- authorized_keys

`-- laoma.pub

如果有,那么進行下面的把laoma.pub文件中的內(nèi)容添加到authorized_keys中.

$ cat laoma.pub >> authorized_keys

>> 是在文件后面追加的意思,主要如果用其他編輯器,每個ssh的pub要單獨一行,建議用cat命令方便簡單。</pre>

到此為止,您配置的客戶端應該可以ssh的方式直接用git賬號登錄服務器。(當然不安全,后面可以控制)

<pre class="md-fences mock-cm md-end-block" spellcheck="false" lang="" cid="n44" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre-wrap; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 在客戶端用ssh測試連接遠程服務器,請將域名aicoder.com換成你的ip地址或者域名
$ ssh git@aicoder.com

第一次連接有警告,輸入yes繼續(xù)即可。如果可以連接上,那么恭喜你的ssh配置已經(jīng)可以了。 </pre>

6. git的自動權(quán)限管理:gitolite(不要跟上面的步驟混做?。。。?/h2>

如果團隊大點的,我們可以用gitolite管理,而且使用很方便。

6.1 gitolite的安裝和配置

第一步:添加gitolite依賴的perl的包

<pre class="md-fences mock-cm md-end-block" spellcheck="false" lang="" cid="n50" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre-wrap; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ yum install 'perl(Data::Dumper)' </pre>

第二步:清空服務器端配置的ssh的公鑰

確保:~/.ssh/authorized_keys文件是空的,或者不存在。如果已經(jīng)存在,建議你把他改名即可,比如:authorized_keys.bak

第三步:上傳管理員的客戶端的ssh公鑰到服務器

把你管理員電腦的ssh的id_rsa.pub文件拷貝到服務器的: $HOME/YourName.pub

YourName可以自定義,最好根據(jù)不同伙伴的名字命名。

參考:

<pre class="md-fences mock-cm md-end-block" spellcheck="false" lang="" cid="n57" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre-wrap; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># mac客戶端
$ scp /Users/fly/.ssh/id_rsa.pub git@aicoder.com:malun.pub</pre>

第四步:安裝配置gitolite

用git賬號登錄,并執(zhí)行如下命令。

<pre class="md-fences mock-cm md-end-block" spellcheck="false" lang="" cid="n60" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre-wrap; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 切換到git賬號
$ su git

進入git主目錄

$ cd /home/git

下載gitolite的倉庫

$ git clone https://github.com/sitaramc/gitolite

創(chuàng)建bin文件夾,必須?。。?/h1>

mkdir -pHOME/bin

用下載下來的倉庫中的insall執(zhí)行安裝操作,指向的目錄就是上一命令行創(chuàng)建的目錄

./gitolite二進制/install -toHOME/bin

把上傳到服務器的 管理員的公鑰setup到gitolite中,注意:YourName.pub改成你自己的文件名。

$ ~/bin/gitolite setup -pk ~/YourName.pub

此時安裝配完成后,查看git主目錄

$ ls /home/git
drwxr-xr-x 7 git git 4096 Apr 3 23:50 bin # 我們創(chuàng)建的存放gitolite二進制
drwxrwxr-x 6 git git 4096 Apr 3 23:40 gitolite
drwx------ 6 git git 4096 Apr 3 23:52 .gitolite
-rw------- 1 git git 7130 Apr 3 23:52 .gitolite.rc
-rw------- 1 git git 398 Apr 3 23:39 malun.pub # 管理員的公鑰
drwxrw---- 3 git git 4096 Apr 3 23:40 .pki
-rw------- 1 git git 19 Apr 4 00:26 projects.list # 倉庫列表(gitolite自動創(chuàng)建)
drwx------ 5 git git 4096 Apr 4 00:26 repositories # 存放所有倉庫文件夾
drwx------ 2 git git 4096 Apr 4 15:50 .ssh

repositories目錄下已經(jīng)有了兩個git倉庫了。

.

|-- gitolite-admin.git # 管理配置權(quán)限的倉庫

`-- testing.git # 測試倉庫</pre>

好了,到此位置,管理員就可以直接把默認的遠程管理的倉庫gitolite-admin直接clone到本地進行管理git服務了。

第五步:管理員在本地管理和配置服務器端的倉庫

下載服務器端的遠程管理倉庫

<pre class="md-fences mock-cm md-end-block" spellcheck="false" lang="" cid="n64" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre-wrap; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"># 下載遠程管理倉庫, 請把aicoder.com換成你自己服務器的域名或者ip
git clone git@aicoder.com:gitolite-admin cd gitolite-admin

目錄結(jié)構(gòu)如下:

.

├── conf # 配置文件夾

│ └── gitolite.conf # 配置權(quán)限的文件

└── keydir # 客戶端的公鑰文件夾,所有伙伴的公鑰要放到此目錄下

└── malun.pub</pre>

6.2 gitolite的權(quán)限配置

  • 添加其他開發(fā)的小伙伴

    把小伙伴的公鑰發(fā)給管理員。管理員添加到gitolite-admin倉庫的keydir目錄下,注意文件名字格式為username.pub,username就是配置權(quán)限時的用戶名。

  • 配置用戶對倉庫的讀寫權(quán)限

    直接修改conf文件夾下的,gitolite.conf文件。簡單解釋下幾個用法:

    • repo代表倉庫的意思,如果新添加一個repo,代表服務端新建一個空倉庫,倉庫push到服務端后會自動創(chuàng)建。

    • RW 代表可讀可寫

    • @all 代表所有人。

    • masterdev代表分支

    參考:

    <pre class="md-fences mock-cm md-end-block" spellcheck="false" lang="" cid="n83" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre-wrap; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;">@admin = malun
    @om = malun bcd

    repo gitolite-admin
    RW+ = malun

    repo testing
    RW+ = @all

    repo om
    RW+ = @admin
    RW+ master = @admin
    RW+ dev = @om </pre>

  • 應用修改到服務器端

做好配置后,由管理員把修改push到服務器端,會自動處理。

<pre class="md-fences mock-cm md-end-block" spellcheck="false" lang="" cid="n87" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre-wrap; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">git add conf git add keydir
git commit -m "added foo, gave access to alice, bob, carol" git push</pre>

此時登錄服務端,查看/home/git/repositories/目錄下是否增加了對應的倉庫了呢?

將已有項目推送到master

cd DZ_PublicSecurity git remote rm origin git remote add origin gitylkj@10.51.100.26:DZ_PublicSecurity.git git push origin master

修改gitolite管理員

image-20210526142008026.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內(nèi)容