`

Git的配置receive.denyCurrentBranch(转帖)

阅读更多

我看过这么多的资源,但无法找到答案。 我有一个Git仓库。 我已经克隆存储库和我的本地更改。当我把我的更改服务器它的工作原理。 当我创建一个分支,我签出的分支,将我的工作,然后签出master分支。我我的本地更改到主分支。当我尝试推到服务器我得到下面的异常:

Welcome to Git (version 1.7.11-preview20120620)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
$ git push origin master:master
 Counting objects: 9, done.
 Delta compression using up to 4 threads.
 Compressing objects: 100% (7/7), done.
 Writing objects: 100% (8/8), 13.68 KiB, done.
 Total 8 (delta 2), reused 1 (delta 0)
 Unpacking objects: 100% (8/8), done.
 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 behaviour, set
 remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
 To c:/jGit
 ! [remote rejected] master -> master (branch is currently checked out)
 error: failed to push some refs to 'c:/gitRepository'

一种解决方案是执行

git config receive.denyCurrentBranch ignore

在此之后它的工作原理。但我想知道为什么我需要这个选项。这是唯一的选择吗?什么是这样做的后果。 我真的很想做的是创建分支,将它们合并到主分支,然后把我的更改服务器。
本文地址 :CodeGo.net/499956/ 

 

转帖地址:http://codego.net/499956/

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics