我正在使用一个我没有写的仓库,并且在知道使用哪个git命令时遇到了麻烦。我在UNIX命令行环境中。当我运行“ git log --all --oneline --graph --decorate”时,存储库的状态如下所示:
some other branches up here that I don't want to change
|
| * ### (HEAD, master) Changed x, y, z
|/
* ### (origin/master, origin/HEAD) Changed a, b, c
我想更新原点/原版,以便进行所有更改。当我从管理员那里运行“ git status”时,它说:
# Your branch is ahead of 'origin/master' by 1 commit.
# (use "git push" to publish your local commits)
但是master分支中的“ git push”和“ git push origin master”给了我这个:
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.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
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 some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behavior, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
! [remote rejected] master -> master (branch is currently checked out)
我尝试过的其他事情是“ git fetch”,它什么也没有返回,而“ git fetch origin master”给了我:
* branch master -> FETCH_HEAD
然后我尝试“ git merge origin / master”,但它告诉我“已经是最新的”
有关更多信息,这是我通过“ git branch -r”获得的
origin/HEAD -> origin/master
origin/master
我是git的新手,如果这是重复问题,我深表歉意。