撤消对 git 配置中 receive.denyCurrentBranch 值的更改
undo changes to value of receive.denyCurrentBranch in git config
尝试推送到非裸存储库时,它提到更改 receive.denyCurrentBranch 的配置
撤消此操作的语句是什么(或它的默认值receive.denyCurrentBranch)?
git config receive.denyCurrentBranch ignore
Git 是 git,有很多方法可以做到这一点。
要设置与默认值相同的值,请参考its documentation以查看默认操作是什么:
$ git help config
然后搜索 receive.denyCurrentBranch
:
If set to true or "refuse", git-receive-pack will deny a ref update to the currently checked out branch of a non-bare repository. Such a push is potentially dangerous because it brings the HEAD out of sync with the index and working tree. If set to "warn", print a warning of such a push to stderr, but allow the push to proceed. If set to false or "ignore", allow such pushes with no message. Defaults to "refuse".
因此,您可以将其设置为 refuse
以使其按照未设置时的方式运行。:
$ git config receive.denyCurrentBranch refuse
当然你也可以直接取消设置:
$ git config --unset receive.denyCurrentBranch
这会在配置中留下 receive
部分,即使它是空的,但这是无害的。但是,如果您愿意,可以使用 git config --remove-section
删除该部分,或者您可以使用 git config --edit
在配置的编辑器中打开整个配置,然后根据需要更新或删除它。
尝试推送到非裸存储库时,它提到更改 receive.denyCurrentBranch 的配置 撤消此操作的语句是什么(或它的默认值receive.denyCurrentBranch)?
git config receive.denyCurrentBranch ignore
Git 是 git,有很多方法可以做到这一点。
要设置与默认值相同的值,请参考its documentation以查看默认操作是什么:
$ git help config
然后搜索 receive.denyCurrentBranch
:
If set to true or "refuse", git-receive-pack will deny a ref update to the currently checked out branch of a non-bare repository. Such a push is potentially dangerous because it brings the HEAD out of sync with the index and working tree. If set to "warn", print a warning of such a push to stderr, but allow the push to proceed. If set to false or "ignore", allow such pushes with no message. Defaults to "refuse".
因此,您可以将其设置为 refuse
以使其按照未设置时的方式运行。:
$ git config receive.denyCurrentBranch refuse
当然你也可以直接取消设置:
$ git config --unset receive.denyCurrentBranch
这会在配置中留下 receive
部分,即使它是空的,但这是无害的。但是,如果您愿意,可以使用 git config --remove-section
删除该部分,或者您可以使用 git config --edit
在配置的编辑器中打开整个配置,然后根据需要更新或删除它。