[英]git push fails after moving remote repository on same server
I've got a git working repo and a bare repo on the same server as follows:我在同一台服务器上有一个 git 工作仓库和一个裸仓库,如下所示:
/
+---dev
| +---work
| | |
| | +---.git
| | +---src
| | +---...
| |
| +---bare-repo.git
|
+---other
Pushing and pulling from the work repo to the bare repo was working fine.从工作仓库推拉到裸仓库工作正常。 Then I had the need to reorganise the directories like this:
然后我需要像这样重新组织目录:
/
+---dev
| +---work
| | |
| | +---.git
| | +---src
| | +---...
|
+---git
| +---bare-repo.git
|
+---other
While in /dev/work
I changed the remote URL with:在
/dev/work
我更改了远程 URL:
git remote set-url origin /git/bare-repo.git
This command succeeded, but when I trying to push
I'm getting:这个命令成功了,但是当我尝试
push
我得到:
fatal: '../bare-repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Interesting.有趣的。 While
git remote -v
shows虽然
git remote -v
显示
origin /git/bare-repo.git (fetch)
origin /git/bare-repo.git (push)
the git config file contains: git 配置文件包含:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
remote = ../bare-repo.git
merge = refs/heads/master
[remote "origin"]
url = /git/bare.repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
So, the set-url
did not change the remote
for branch master.因此,
set-url
没有更改分支主服务器的remote
。 Should it?应该是? I guess, no.
我觉得不是。 So the command I've found to change the URL of the remote 'origin' was not the best.
因此,我发现更改远程“来源”的 URL 的命令并不是最好的。 I can edit the config file and correct the path manually, I suppose, but what would have been the correct procedure?
我想我可以编辑配置文件并手动更正路径,但是正确的程序是什么?
I don't know how this happened:我不知道这是怎么发生的:
[branch "master"] remote = ../bare-repo.git merge = refs/heads/master
but the middle line should read:但中间的一行应该是:
remote = origin
With that fixed, everything else should Just Work.有了这个固定,其他一切都应该正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.