When using git push code to the Data warehouse, you are prompted with the following error:
[Remote rejected] master, master (branch is currently checked out)
Error prototypes
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'll make the index and work tree inconsistent
Remote:error:with What do you pushed, and would 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 isn't recommended unless you
Remote:error:arranged to update their work tree to match the what's pushed in some
Remote:error:other.
Remote:error:
Remote:error:To squelch This message and still keep the default behaviour, set
Remote:error: ' receive.denycurrentbranch ' configuration variable to ' refuse '.
to [email protected]:/var/git.server/.../web
! [Remote rejected] master, master (branch is currently checked out)
Error:failed to push some refs to ' [email protected]:/var/git.server/.../web '
Workaround:
This is because GIT denies the push operation by default, it needs to be set up, and the following code is added after the. git/config file is modified:
[Receive] Denycurrentbranch = Ignore
Unable to view the cause and workaround for files in the push git
Best to use when initializing remote repositories
Git--bare init
Instead of using: Git init
The exact difference between git init and git--bare init: http://blog.haohtml.com/archives/12265
=================================================
If git init initialization is used, the directory of the remote repository also contains the work tree, and when the local repository is push to the remote repository, if the remote warehouse is on a push branch (no problem if it is not in the push branch at that time), The result of the push will not be reflected on the work tree, which is the corresponding file in the remote repository directory or the previous content.
Workaround:
You must use the command git reset--hard to see the content after the push.
Studied for a long time without its solution, and then found a command to make it work: Log in to the remote folder and use
git config--bool core.bare true
It's done.
Workaround for "remote:error:refusing to update checked out Branch:refs/heads/master"