git workflow laptop-desktop-github

时间:2012-02-05 15:06:47

标签: git

我想拥有以下git工作流程,

        github
        /    \
  laptop-----desktop    

这个想法是桌面与笔记本电脑保持同步,每当从任何一台计算机上推送到github时都会发生。

由于我的笔记本电脑不是永久在线,我需要一种从笔记本电脑拉到桌面的方法。在笔记本电脑上,我克隆了github repo,然后为桌面制作了一个遥控器。然后我设置了一个跟踪分支(在笔记本电脑上)来跟踪桌面上的分支“开发”。

> git branch --track develop desktop/develop

我在笔记本电脑上进行分支'develop'的更改,提交,并尝试推送到桌面。

>git push desktop
...
remote: error: refusing to update checked out branch: refs/heads/develop

remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.    
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable t
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in som
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, se
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh:// ....
 ! [remote rejected] develop -> develop (branch is currently checked out)

我读了一下有关错误的内容,听起来像推荐的事情是从桌面拉出,而不是从笔记本电脑推出,但这不是一个选项。

1 个答案:

答案 0 :(得分:0)

git说你正确的做法:你可以在远程存储库中将receive.denyCurrentBranch配置变量设置为'ignore'或'warn'以允许推送到 它目前的分支