linux 安裝GIT

轉載地址:https://blog.csdn.net/qq_31059985/article/details/80606882

服務器 CentOS7 + git version 1.8.3.1
客戶端 Windows7 + git version 2.17.1.windows.2

服務器端安裝和配置

安裝Git服務器端

yum install git

安裝完後,查看 Git 版本

[root@iZm5egstry6atum2bewjdgZ ~]# git --version
git version 1.8.3.1

創建服務器端git倉庫,這裏倉庫設置爲:/usr/local/gitrepository

 

[root@iZm5egstry6atum2bewjdgZ local]# mkdir -p /usr/local/gitrepository
[root@iZm5egstry6atum2bewjdgZ local]# cd /usr/local/gitrepository

[root@iZm5egstry6atum2bewjdgZ gitrepository]# git init --bare /usr/local/gitrepository
Initialized empty Git repository in /usr/local/gitrepository/

服務器端創建 git 用戶,用來管理 Git 服務,併爲 git 用戶設置密碼,

 

[root@iZm5egstry6atum2bewjdgZ gitrepository]# id git
id: git: no such user
[root@iZm5egstry6atum2bewjdgZ gitrepository]# useradd git
[root@iZm5egstry6atum2bewjdgZ gitrepository]# passwd git
Changing password for user git.
New password: 627woaini
BAD PASSWORD: The password contains the user name in some form
Retype new password: 627woaini
passwd: all authentication tokens updated successfully.

 

 

然後把 Git 倉庫的所有者修改爲 git用戶


 
[root@iZm5egstry6atum2bewjdgZ gitrepository]# cd ..
[root@iZm5egstry6atum2bewjdgZ local]# chown -R git:git gitrepository/

 

客戶端安裝和配置

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

一路next安裝完之後,創建一個git本地存放地址,如:Z:\gittest 進入Z:\gittest 右鍵 Git Bash 打開命令行客戶端。

安裝完之後,查看 Git 版本

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章