git on serverssh深入剖析,github提供服務原理

來源:互聯網
上載者:User
1.安裝好linux,安裝好git(192.168.1.239)

2.建立一個使用者zph(讓此使用者提供git on server),密碼設定為12345678

# useradd zph
# passwd zph
3.切換到zph使用者 
# su zph

$ cd 

4.建立一個遠程倉庫
$ git init --bare sample.git

5.在windows下(192.168.1.5),開啟git bash
$ git clone zph@192.168.1.239:/home/zph/sample.git

終端會讓輸入密碼,此時輸入zph使用者的密碼即(12345678)

6.為了讓使用者,不用每次都輸入密碼,在linux產生.ssh目錄

$ ssh-keygen -t rsa -C "youremail@example.com"

7.進入.ssh,建立一個authorized_keys檔案
$ cd /home/zph/.ssh/  

$ vi authorized_keys

8.開啟windows中目前使用者的.ssh/id_rsa.pub,複製裡面的內容,粘貼到第7步中的authorized_keys中9.更改authorized_keys檔案的許可權
$chmod 600 authorized_keys 
10.驗證authorized_keys有沒有生效,開啟windows
$ ssh zph@192.168.1.239

如果不需要輸入密碼,代表生效了

11.重複第5步,已經不需要輸入密碼了

12.假如不想zph作為一個帳號登陸系統,可以開啟/etc/passwd
zph:x:1002:1002::/home/zph:/bin/bash改為zph:x:1002:1002::/home/zph:/sbin/nologin

附加:

學習git請參考網址https://git-scm.com/book/zh/v2

以上就介紹了 git on serverssh深入剖析,github提供服務原理,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.