日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

git 创建远程版本库(亲测有效)

發布時間:2024/10/8 编程问答 34 如意码农
生活随笔 收集整理的這篇文章主要介紹了 git 创建远程版本库(亲测有效) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、github遠程版本庫

1、創建SSH Key(windows)

  1.  
    ssh-keygen -t rsa -C "youremail@example.com"
  2.  
    2、連接版本庫
  git remote add origin git@github.com:ltt2725738034/ll.git
 3、克隆版本庫
  git clone git@github.com:ltt2725738034/ll.git
 4、添加
  git add 文件名
 5、提交
  git commit -m '提示'
 6、推到版本庫
  git push origin +分支名(master主分支)
二、Linux版本庫
   1、創建用戶
    useradd ltt
   2、 修改密碼
    passwd ltt
   3、切換到用戶
    su ltt
    cd
   4、創建遠程版本庫
    git init --bare ltt.git
   5、在Windows下克隆
    git clone ltt@192.168.1.182:/home/ltt/ltt.git
    終端會讓輸入密碼,此時輸入ltt用戶的密碼即(12345678)
   6、為了讓用戶,不用每次都輸入密碼,在linux生成.ssh目錄(win)
    ssh-keygen -t rsa -C "youremail@example.com"
   7、進入.ssh,新建一個authorized_keys文件
    cd /home/ltt/.ssh/
    vi authorized_keys
   8、打開windows中當前用戶的.ssh/id_rsa.pub,復制里面的內容,粘貼到第7步中的authorized_keys中
   9、更改authorized_keys文件的權限
    chmod 600 authorized_keys
   10、驗證authorized_keys有沒有生效,打開windows
    git clone git@github.com:ltt2725738034/ll.git
    如果不需要輸入密碼,代表生效了
   11、代碼自動更新
     cp /home/zph/sample.git/hooks/post-update.sample /home/zph/sample.git/hooks/post-update
   12、打開post-update,先清空內容,然后進行編輯如下
     #!/bin/bash

#如果想要發送郵件則開啟下面兩行,關于發送郵件請訪問 http://blog.csdn.NET/zph1234/article/details/50509885

#var=`git show`     #PHP /var/www/html/mail.php "$var"

cd /usr/share/nginx/html/sample     unset GIT_DIR

git checkout master     git pull 13、出于安全考慮,只讓克隆提交版本庫,不讓登陸終端 $ which git-shell /usr/bin/git-shellvi /etc/passwd

ph:x:1000:1000:zhangpenghui:/home/zph:/usr/bin/git-shell

總結

以上是生活随笔為你收集整理的git 创建远程版本库(亲测有效)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。