利用git讓服務器網站與本地同步 ssh配置

嘛,就是將服務器上的網站和本地同步。
方法1
首先是上傳服務器上的網站到github倉庫
git init
git add .
git commit -m ''
關聯遠程倉庫,先去github上新建一個,new repository
git remote add origin 你的遠程庫地址
同步 合併
git pull --rebase origin master
推送
git push -u origin master
克隆
git clone git@github.com:jaxma/pig.git pightml

ssh的問題
查看有沒有id_dsa.pubgit

cd ~/.sshgithub

沒有的話web

ssh-keygen -t rsa -C "your_email@youremail.com"服務器

好比個人ssh

git@github.com:jaxmaide

cat ~/.ssh/id_rsa.pub網站

複製公鑰.net

到SSH and GPG keys裏添加htm

方法2
服務器git倉庫
服務器倉庫就至關於中轉站,只要用git remote add origin命令推送事後,本地倉庫和服務器要同步的文件夾均可以進行push、pull操做
hook 本地push的同時讓服務器更新文件

http://www.javashuo.com/article/p-rvtbgjlx-w.html

方法3
用github的webhook
若是有寶塔的話用寶塔的webhook
https://www.bt.cn/bbs/thread-5348-1-1.html

更新:
克隆時端口不是22的問題
加ssh://
例如
git clone ssh://git@ip:端口/home/git/xx.git

權限chown -R root:root pig.git/

相關文章
相關標籤/搜索