debian下安裝git伺服器

2021-08-14 08:23:29 字數 2284 閱讀 6014

linux 做為伺服器端系統,windows 作為客戶端系統,分別安裝 git

伺服器端:

#yum install -y git
安裝完後,檢視 git 版本

[root@localhost ~]# git --version

git version

1.7.1

客戶端:

安裝完之後,可以使用 git bash 作為命令列客戶端。

安裝完之後,檢視 git 版本

$ git --version

git version

2.8.4.windows.1

[root@localhost home]# id git

id: git:無此使用者

[root@localhost home]# useradd git

[root@localhost home]# passwd git

設定 /home/data/git/gittest.git 為 git 倉庫

然後把 git 倉庫的 owner 修改為 git

[root@localhost home]# mkdir -p data/git/gittest.git

[root@localhost home]# git init --bare data/git/gittest.git

initialized empty git repository

in /home/data/git/gittest.git/[root@localhost home]# cd data/git/[root@localhost git]# chown -r git:git gittest.git/

進入 git bash 命令列客戶端,建立專案位址(設定在 d:/wamp64/www/gittest_gitbash)並進入:

dee@lenovo-pc mingw64 /d

$ cd wamp64/www

dee@lenovo-pc mingw64 /d/wamp64/www

$ mkdir gittest_gitbash

dee@lenovo-pc mingw64 /d/wamp64/www

$ cd gittest_gitbash

dee@lenovo-pc mingw64 /d/wamp64/www/gittest_gitbash

$

然後從 linux git 伺服器上 clone 專案:

$ git clone [email protected]:/home/data/gittest.git
如果ssh用的不是預設的22埠,則需要使用以下的命令(假設ssh埠號是7700):

選擇 yes:

檢視客戶端專案目錄:

專案已經 clone 了。

**同步(hook)

上邊git用於做了中心的版本控制

但是還想讓伺服器接到修改更新後自動同步**到**目錄中,便於測試開發

如下操作是可以實現

#假定**目錄在/www/web下

cd /home/git/repo.git/hooks

vim post-receive #建立乙個鉤子

#寫入下面內容

git_work_tree=/www/web git checkout -f

#儲存退出

chown git:git post-receive

chmod +x post-receive

如此,下次提交修改,**會自動同步到指定目錄

CentOS伺服器下安裝git

本文環境centos6.8的虛擬機器 centos6.10的阿里雲伺服器 在虛擬機器命令列中輸入 ssh root 1.1.1.1 這裡的1.1.1.1就是你的伺服器公網ip位址 輸入密碼進入伺服器 新建資料夾 cd mkdir developer cd developer mkdir setup ...

debian上安裝nfs伺服器

安裝好 nfs伺服器後,etc 下會有乙個 nfs的配置檔案 exports 初次配置時此檔案是空的,需要向該檔案中新增內容。此檔案的格式在 exports 5 中,具體可以 man一下,這裡舉一些例子 解釋 第一行是注釋,提醒 exports 檔案的格式 後面每一行都列出了要共享的檔案系統以 可以...

Debian 安裝 EMQ X 伺服器指南

您可以根據需要以不同方式安裝 emq x 在新主機上首次安裝 emq x 之前,需要設定 emq x 映象庫。之後,您可以從映象庫安裝和更新 emq x 設定映象庫 1.更新apt包索引 sudo apt update2.安裝必要的軟體 software properties common3.新增 ...