centos 搭建 git 服務端和用戶端

來源:互聯網
上載者:User

標籤:

centos 搭建git需要設定遠程服務端和用戶端。遠程代碼存放在服務端,多個用戶端可以共用和維護服務端代碼。

一、服務端主機

1.建立ssh,大部分預設已經安裝,有ssh就跳過

yum install openssh-server -y

2. 安裝git

yum -y install git-core

3.1 建立git使用者

useradd git

3.2 設定密碼

passwd git

4. git使用者登入

su git

5. 初始化伺服器端倉庫

cd /home/git
git init -–bare web.code.git

// web.code.git為庫名

假設服務端的ip為192.168.1.222,git服務地址就為:[email protected]:/home/git/web.code.git

伺服器就OK了

 

二、用戶端電腦

1.  安裝git

2. 複製服務端倉庫

git clone [email protected]:/home/git/web.code.git  web.code

// 複製服務端倉庫,放置在本地目錄 web.code 。

3. 基礎配置

git config --global user.mail "[email protected]"

git config --global user.name "user_name"

4. 現在可以使用了。

預設只有master分支。我們可以自行建立分支,建立檔案,提交檔案,合并分支,提交到服務端。

 

centos 搭建 git 服務端和用戶端

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.