当我尝试从工作树提交时,回购配置文件 更改为不正确的远程URL。 当我从主工作树提交时,它又变回正确的了。
在主分支的仓库中,我通过以下方式创建工作树:
/path/to/my/master$ git worktree add ../branch_x -b feature/branch_x
当我准备好提交
path/to/my/branch_x$ git add .
path/to/my/branch_x$ git commit -m "some message"
然后在/path/to/my/master/.git/config文件中
[remote "origin"]
url = ssh://path_to_bitbucket:7999/bitbucket/proj/master.git
fetch = +refs/heads/*:refs/remotes/origin/*
pushurl = git@path_to_bitbucket/master.git
已更改为
[remote "origin"]
url = ssh://path_to_bitbucket:7999/bitbucket/proj/branch_x.git
fetch = +refs/heads/*:refs/remotes/origin/*
pushurl = git@path_to_bitbucket/branch_x.git
然后所有与远程操作失败...