Git同步本地代码

第一种情况、Git同步Windows和Ubuntu下的代码

1、首先创建代码库(ubuntu下)

cd /home/xsy/file
git init
git add .
git commit -m

2、中间库的创建

cd /home/xsy/file-bare
git clone --bare ../file/.git ./file-bare.git

3、返回代码库目录中去设置中间库作为远程库

cd /home/xsy/file
git remote add origin ../file-bare/file-bare.git

4、在windows下克隆中间库:git clone ssh://用户名@IP/库地址

git clone ssh://[email protected]/home/xsy/file-bare/file-bare.git

5、ubuntu端代码库的跟踪设置

git branch --set-upstream-to=origin/master master
git push --set-upstream origin master

 

 

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