什么意味着遥远=。在GIT配置?

时间:2013-07-22 17:56:05

标签: git

我不确定如何(用EGit创建分支,可能)我在配置中以此部分结束:

[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "sfc"]
    remote = .
    merge = refs/heads/master
    rebase = true

我想理解这一点。我不确定remote = .中的点是否被解释为url(当前目录)或特殊存储库名称(我自己的别名)?这是合法/正常/典型,还是我猜这是搞砸了?有一个指向同一个存储库的“远程”规范让我觉得很奇怪。此外,该分支确实存在于遥控器中......这对于推/拉行为的含义是什么?

更多信息:

$ git remote show origin
* remote origin
  Fetch URL: ssh://git@10.0.0.3/var/gitrep/zzz.git
  Push  URL: ssh://git@10.0.0.3/var/gitrep/zzz.git
  HEAD branch: master
  Remote branches:
    master tracked
    sfc    tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local refs configured for 'git push':
    master pushes to master (fast-forwardable)
    sfc    pushes to sfc    (up to date)

$ git branch -vv
* master     f394d8b [origin/master: ahead 1] Bla blah...
  sfc        8065309 [master: behind 89] Bla blah...

2 个答案:

答案 0 :(得分:4)

这很奇怪。我继续创建了一个虚拟仓库,更改了.git/config以使远程变为.,添加了一些代码,提交并推送。

$ git checkout weird
$ touch nothing
$ git add nothing
$ git commit -a -m "test"
[sup 031541e] test
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 nothing
$ git push
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push . HEAD:master

To push to the branch of the same name on the remote, use

git push . weird

$ git push . weird
Everything up-to-date

它似乎在本地命中了存储库,这当然意味着推送导致git说它是最新的。

答案 1 :(得分:2)

Git会将此解析为相对路径,就像../../some/other/repo一样。因此,它将解析存储库本身的目录。由于您的远程合并目标为master,但在git push结束时运行sfc,只会尝试将master快进到sfc

您可以通过运行

创建这样的分支
git branch --set-upstream somebranch

也许这就是你所做的,因为你忘了设置一个远程分支作为起点。

相关问题