国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > Linux > 正文

在Linux下搭建Git服務(wù)器步驟

2019-11-02 16:59:21
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

環(huán)境:

服務(wù)器 CentOS6.6 + git(version 1.7.1)

客戶端 Windows10 + git(version 2.8.4.windows.1)

 ① 安裝 Git

Linux 做為服務(wù)器端系統(tǒng),Windows 作為客戶端系統(tǒng),分別安裝 Git

服務(wù)器端:

#yum install -y git

安裝完后,查看 Git 版本

[root@localhost ~]# git --versiongit version 1.7.1

客戶端:

下載 Git for Windows,地址:https://git-for-windows.github.io/

安裝完之后,可以使用 Git Bash 作為命令行客戶端。

安裝完之后,查看 Git 版本

$ git --versiongit version 2.8.4.windows.1

② 服務(wù)器端創(chuàng)建 git 用戶,用來(lái)管理 Git 服務(wù),并為 git 用戶設(shè)置密碼

[root@localhost home]# id gitid: git:無(wú)此用戶[root@localhost home]# useradd git[root@localhost home]# passwd git

③ 服務(wù)器端創(chuàng)建 Git 倉(cāng)庫(kù)

設(shè)置 /home/data/git/gittest.git 為 Git 倉(cāng)庫(kù)

然后把 Git 倉(cāng)庫(kù)的 owner 修改為 git

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

④ 客戶端 clone 遠(yuǎn)程倉(cāng)庫(kù)

進(jìn)入 Git Bash 命令行客戶端,創(chuàng)建項(xiàng)目地址(設(shè)置在 d:/wamp64/www/gittest_gitbash)并進(jìn)入:

dee@Lenovo-PC MINGW64 /d$ cd wamp64/wwwdee@Lenovo-PC MINGW64 /d/wamp64/www$ mkdir gittest_gitbashdee@Lenovo-PC MINGW64 /d/wamp64/www$ cd gittest_gitbashdee@Lenovo-PC MINGW64 /d/wamp64/www/gittest_gitbash$

然后從 Linux Git 服務(wù)器上 clone 項(xiàng)目:

$ git clone git@192.168.56.101:/home/data/gittest.git 

  

當(dāng)?shù)谝淮芜B接到目標(biāo) Git 服務(wù)器時(shí)會(huì)得到一個(gè)提示:

The authenticity of host '192.168.56.101 (192.168.56.101)' can't be established.RSA key fingerprint is SHA256:Ve6WV/SCA059EqoUOzbFoZdfmMh3B259nigfmvdadqQ.Are you sure you want to continue connecting (yes/no)?

選擇 yes:

Warning: Permanently added '192.168.56.101' (RSA) to the list of known hosts.

此時(shí) C:/Users/用戶名/.ssh 下會(huì)多出一個(gè)文件 known_hosts,以后在這臺(tái)電腦上再次連接目標(biāo) Git 服務(wù)器時(shí)不會(huì)再提示上面的語(yǔ)句。

后面提示要輸入密碼,可以采用 SSH 公鑰來(lái)進(jìn)行驗(yàn)證。 

⑤ 客戶端創(chuàng)建 SSH 公鑰和私鑰

$ ssh-keygen -t rsa -C 

此時(shí) C:/Users/用戶名/.ssh 下會(huì)多出兩個(gè)文件 id_rsa 和 id_rsa.pub

id_rsa 是私鑰

id_rsa.pub 是公鑰

⑥ 服務(wù)器端 Git 打開(kāi) RSA 認(rèn)證

進(jìn)入 /etc/ssh 目錄,編輯 sshd_config,打開(kāi)以下三個(gè)配置的注釋:

RSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keys
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 富裕县| 大关县| 革吉县| 勐海县| 平泉县| 青神县| 探索| 江孜县| 陆河县| 岢岚县| 浦江县| 祥云县| 盘山县| 莱州市| 马关县| 华宁县| 思南县| 天等县| 屏山县| 胶南市| 阜新| 昭觉县| 双桥区| 察隅县| 渑池县| 清流县| 乌恰县| 隆回县| 盐山县| 安徽省| 开阳县| 南溪县| 贵南县| 新绛县| 永康市| 中西区| 稷山县| 阳朔县| 紫金县| 息烽县| 祁东县|