1、创建远程(中转)仓库
- 创建远程仓库文件夹
mkdir XXX
- 创建一个裸库,主要应用场景是作为公共仓库
git init --bare --shared
- 若 git remote 返回 origin,代表创建成功
git remote add origin file:/远程仓库文件夹的路径
git remote
【origin】
2、创建本地仓库
- 创建本地仓库文件夹
mkdir XXX
git clone file:/远程仓库文件夹的路径 本地仓库文件夹名
- 创建 test.txt 文件,并输入内容
vim test.txt
- 保存并修改
git add .
git commit -m "feat:提交内容"
git branch --unset-upstream
git push -u origin --all
3、将远程文件夹设置为共享文件夹
4、在其他电脑同步仓库
git clone ssh://xxx@192.168.1.15/远程仓库文件夹的路径 本地仓库文件夹
cd 本地仓库文件夹
git pull origin master
- 参考文档
https://www.cnblogs.com/phillee/p/15353020.html