remote: error: By default, deleting the current branch is denied,
because the next
remote: error: 'git clone' won't result in any file checked out,
causing confusion.
remote: error:
remote: error: You can set 'receive.denyDeleteCurrent' configuration
variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow
deleting the
remote: error: current branch, with or without a warning message.
remote: error:
remote: error: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/
master
就是说如果想要删除HEAD标识的当前分支,可以设置 receive.denyDeleteCurrent
为 warn 或者 ignore。一旦远程版本库包含了 receive.denyDeleteCurrent 为 ignore
的设置后,就可以远程删除版本库任意分支,甚至是远程版本库中用 HEAD 文件标识的
当前分支。
有两种方法可以对远程服务器中创建的新版本库自动设置 receive.denyDeleteCurrent,
一种是通过书中P562页介绍的Git模版,即在模版目录中添加一个 config 文件。
另外一种方法是使用 gitolite 做服务器,通过在配置文件中添加相应 config 指令,见 P439.
Gerrit 重造了轮子,用 Java 重新实现了Git(JGit),因此有些细节没有模仿出来,例如
receive.denyDeleteCurrent。我在 Gerrrit 2.1.8 上没有发现删除当前分支的好办法,除非
将当前分支指向另外一个,才能删除。
我到 repo-discuss 里问的结果和你说的差不多,有人说给出了移动 HEAD 的命令: 'git symbolic-ref HEAD
refs/heads/mybranch'
之后试试看行不行
GitHub 解决这个问题,是提供一个Web界面可以更改当前版本库HEAD指向的分支。参见:
http://gotgit.github.com/gotgithub/03-project-hosting/020-repo-operation.html
中的 "3.2.3. 设置默认分支" 和 "3.2.4. 删除分支"。
看看 jgit 代码,也许能找到更优雅的方式?或者向 jgit 提出改进需求。
On Oct 12, 2:27 pm, Chunlin Zhang <zhangchun...@gmail.com> wrote:
> 2011/10/12 Jiang Xin <worldhello....@gmail.com>:
试过是可以,不过是要在服务端做这个事情,是比较ugly,不过还好很少有这种情况.
>
>
> On Oct 12, 2:27 pm, Chunlin Zhang <zhangchun...@gmail.com> wrote:
>> 2011/10/12 Jiang Xin <worldhello....@gmail.com>:
>>
>> > Gerrit 重造了轮子,用 Java 重新实现了Git(JGit),因此有些细节没有模仿出来,例如
>> > receive.denyDeleteCurrent。我在 Gerrrit 2.1.8 上没有发现删除当前分支的好办法,除非
>> > 将当前分支指向另外一个,才能删除。
>>
>> 我到 repo-discuss 里问的结果和你说的差不多,有人说给出了移动 HEAD 的命令: 'git symbolic-ref HEAD
>> refs/heads/mybranch'
>>
>> 之后试试看行不行
>
> --
> 您收到这封邮件是因为您订阅了 Google Groups "GotGit" 邮件组。
> 向邮件组发言很简单,发送邮件到: got...@googlegroups.com 即可。
> 如果不想继续收到相关邮件,发送退订邮件到 gotgit+un...@googlegroups.com 。
> 您也可以通过 Web 界面访问和配置本邮件列表:
> http://groups.google.com/group/gotgit?hl=en?hl=en
>
从命令行想办法是行不通的,因为 JGit 代码中没有对 'receive.denyDeleteCurrent' 的支持。
On Oct 12, 3:36 pm, Chunlin Zhang <zhangchun...@gmail.com> wrote:
> 2011/10/12 Jiang Xin <worldhello....@gmail.com>:
> > 看看 jgit 代码,也许能找到更优雅的方式?或者向 jgit 提出改进需求。
>
> 试过是可以,不过是要在服务端做这个事情,是比较ugly,不过还好很少有这种情况.
>
> 只能删除其他分支,也许以后 Gerrit 提供类似 GitHub 重新设定 HEAD 指向功能。
>
> 从命令行想办法是行不通的,因为 JGit 代码中没有对 'receive.denyDeleteCurrent' 的支持。
这个没看懂是啥意思...
>
> On Oct 12, 3:36 pm, Chunlin Zhang <zhangchun...@gmail.com> wrote:
>> 2011/10/12 Jiang Xin <worldhello....@gmail.com>:
>
>> > 看看 jgit 代码,也许能找到更优雅的方式?或者向 jgit 提出改进需求。
>>
>> 试过是可以,不过是要在服务端做这个事情,是比较ugly,不过还好很少有这种情况.
>>
>