1, 首先备份 .git/config
打开 config , 只保留如下部分
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
2, 回到.git同级目录执行
3, 再次打开.git/config
发现会变成这个样子了:
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “origin”]
url = ssh://user@123.321.123.321:88888/home/user/git/neten.git
fetch = +refs/heads/:refs/remotes/origin/
我们需要添加一个单元, 最后是这样子:
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “origin”]
url = ssh://user@123.321.123.321:88888/home/user/git/neten.git
fetch = +refs/heads/:refs/remotes/origin/
[branch “master”]
remote = origin
merge = refs/heads/master
4, 登录服务器123.321.123.321, 建立远程git库
$ mkdir neten.git
$ cd neten.git
$ git init —bare
5, 回到本地执行