1、為Centos系統(tǒng)創(chuàng)建Git用戶
成都創(chuàng)新互聯(lián)主要從事成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、外貿(mào)營(yíng)銷網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)福海,十多年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575
useradd -d /home/git git #創(chuàng)建git用戶
passwd git #修改密碼
2、打開Centos系統(tǒng)RAS認(rèn)證
vim /etc/ssh/sshd_config
打開以下注釋,修改如下
3、下載windows版本Git安裝軟件,根據(jù)操作系統(tǒng)選擇32位或64位
https://git-scm.com/download/win
4、安裝Git,一直下一步
5、生成windows的ssh key,在目錄點(diǎn)右鍵,選擇Git Bash Here,在打開的命令行輸入以下命令,一路確認(rèn)
ssh-keygen -t rsa -C "youremail@example.com"
6、上傳ssh key至Centos系統(tǒng),在Windows的Git Bash中輸入以下命令
ssh git@192.168.106.129 'cat >> .ssh/authorized_keys' < ~/.ssh/id_rsa.pub
成功后檢查Centos系統(tǒng)/home/git/.ssh/目錄下是否生成authorized_keys文件,以及該文件中是否有Windows的id_rsa.pub公鑰內(nèi)容,文件位于C:\Users\xxx.ssh目錄下
7、配置sshd服務(wù)
vim /etc/ssh/sshd_config
修改一下內(nèi)容
PermitRootLogin no
UsePAM no
PasswordAuthentication no
RSAAuthentication yes
PubkeyAuthentication yes
重啟服務(wù)
systemctl restart sshd.service
8、在Centos系統(tǒng)創(chuàng)建版本庫
su git
cd /home/git/
mkdir repository
cd repository
mkdir test.git
git init --bare test.git
9、禁止git用戶登陸shell,后續(xù)創(chuàng)建版本庫可由root用戶創(chuàng)建,創(chuàng)建完chown為git用戶
vim /etc/passwd
10、通過Windows遠(yuǎn)程clone版本庫,在Windows創(chuàng)建要clone的目錄,打開Git Bash,輸入
git init
git clone git@192.168.106.129:/home/git/repository/test.git
網(wǎng)頁標(biāo)題:Git配置(二)Windows安裝Git,并配置Centos
當(dāng)前網(wǎng)址:http://chinadenli.net/article40/gicoho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、網(wǎng)站設(shè)計(jì)公司、營(yíng)銷型網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、小程序開發(fā)、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)