可能重复:
git push error '[remote rejected] master -> master (branch is currently checked out)'Git的基本工作流程
我是新来的Git,并试图将它用于本地Grails项目。
步骤我跟着:
- 创建Grails项目
- 进入项目目录和
git init
- 添加的所有文件在项目中临时区域和提交。
在回购的git的状态给出了以下消息
[email protected] /c/Work/Grails/projects/yyy/tables (master) $ git status # On branch master nothing to commit (working directory clean)
试图保持它作为主分支,通过克隆回购进行更改,后来又推又变回。为此
- 在我的IDE中,签出项目(IntelliJ)。这实际上是将项目克隆到另一个目录。
- 进行更改并提交项目
将本地更改推送到主站。
15:41:56.249: git push -v origin master Pushing to c:/Work/Grails/projects/xxx/tables remote: error: refusing to update checked out branch: refs/heads/master 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.
克隆回购状态
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
请帮我理解这一点。是否有更好的工作流程要遵循。我可以通过Intellij初始化回购,并尝试在主分支上工作。仍然不确定上面有什么错。
谢谢。
只需推入不同的分支,然后合并它:'git push origin master:foo'。 – kenorb 2015-09-30 15:32:51