♦安裝git

♦伺服器建立git使用者

[root@localhost home]# id git
id: git:無此使用者
[root@localhost home]# useradd git
[root@localhost home]# passwd git

♦伺服器建立git倉庫

[root@localhost home]# mkdir -p data/git/gittest.git
[root@localhost home]# git init --bare data/git/gittest.git
[root@localhost home]# cd data/git/
[root@localhost git]# chown -R git:git gittest.git/

♦可以建立專案(測試沒做)

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

[root@localhost gittest]# git clone ssh://[email protected]/data/git/gittest.git/

埠如果不是22

[root@localhost gittest]# git clone ssh://[email protected]:2994/data/git/gittest.git/

[email protected]'s password:     git使用者密碼

♦jenkins呼叫git需要將jenkins的公鑰傳給/home/git/.ssh/authorized_keys檔案裡。將jenkins的私鑰傳到憑證裡面