Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法删除带有特殊字符的git远程分支_Git_Command Line Interface_Git Branch - Fatal编程技术网

无法删除带有特殊字符的git远程分支

无法删除带有特殊字符的git远程分支,git,command-line-interface,git-branch,Git,Command Line Interface,Git Branch,请在把这个问题标记为重复之前仔细阅读 如果列出分支,则显示如下所示: $git branch -a remotes/origin/feat/verify-<C3>email 如果尝试从Github仪表板访问分支url: The github page broke into a HTTP error 400 如果尝试删除分支,请执行以下操作: $ git push origin --delete feat/verify-√email error: unable to delet

请在把这个问题标记为重复之前仔细阅读

如果列出分支,则显示如下所示:

$git branch -a
  remotes/origin/feat/verify-<C3>email
如果尝试从Github仪表板访问分支url:

The github page broke into a HTTP error 400
如果尝试删除分支,请执行以下操作:

$ git push origin --delete feat/verify-√email
error: unable to delete 'feat/verify-√email': remote ref does not exist
error: failed to push some refs to 'https://mataide@github.com/mataide/proak-website.git'
按模式删除:

git branch -d -r $(git branch --list origin/feat/ve* -r)
error: cannot lock ref 'refs/remotes/origin/feat/verify-?email': Unable to create '/Users/marcus/Documents/Workspace/proak-website/.git/refs/remotes/origin/feat/verify-?email.lock': Illegal byte sequence
error: Error deleting remote-tracking branch 'origin/feat/verify-?email'
如果您尝试使用名称:feat/verify email,则会出现相同的错误。 如果您尝试使用Sourcetree之类的工具进行删除,也不起作用


我只想删除分支,有什么帮助吗?

我从您的帖子中剪切和粘贴的字符是一个Unicode字符,表示平方根:U+221A请参见。另一个Git中的一个实际上是某个非Unicode字符集中的代码字节C3。你需要让另一个Git以某种方式删除它

git push--delete
是个好主意,但是您必须将准确的字节序列发送到另一个git。我不清楚在你使用的终端会话中如何做到这一点。如果您在MacOS上,您可以编辑一个具有正确字节序列的shell脚本文件:只需运行
git branch-r>/tmp/script
,在合适的编辑器中打开该文件(例如,
vim
),删除所有不相关的行,并将
git push origin--delete
插入名称不正确的其余行的前面。然后运行生成的脚本,例如,
sh/tmp/script
。在没有人手(或编辑器)触摸行上的字节的情况下,原始字节码序列应保持不变

使用
git branch-d-r
即使有效,也不会有真正的帮助,因为只要这个名称存在于另一个git中,它就会不断出现。但是,一旦您在另一个Git上清除了可能需要外部帮助(例如,来自GitHub的人)的坏名称,a
Git fetch--prune
也可能无法在您自己的存储库中丢弃远程跟踪名称。(不过先试试看。)


由于您的操作系统不允许您为该名称创建锁文件,您需要手动删除正确的条目,该条目将是
.git/packed refs
文件中的一行。使用仅限文本文件的编辑器(不是富文本编辑器),该编辑器可以处理以换行符结尾的行(不是CRLF)并删除该行。

这有帮助吗@Renat尝试了解决方案,但也给出了一个错误。我会更新这个问题。你有没有可能通过远程用户界面(如github、gitlab等)进行更新?@JakeParis,我尝试过使用Sourcetree。它也给出了未找到的错误。是的,但是SourceTree不是本地应用程序吗?我在想,也许远程UI可以更好地处理分支名称中的特殊字符。谢谢你的回答。我正在使用MacOS。终端支持Unicode。因此,对于我来说,键入cli或运行sh脚本,结果应该是相同的。我尝试了vim创建的脚本。错误是一样的。如果我错了,请纠正我。在这种情况下,可能上游分支已经被删除,您只需要运行
git fetch-p
(如果失败,请运行
vim.git/packed refs
,并删除坏行)。它没有被删除,因为我仍然可以在github仪表板中访问它。您可以使用此unicode创建一个新分支,它将以同样的方式失败。有趣。那么,您可能需要获得GitHub支持才能删除它。
git branch -d -r $(git branch --list origin/feat/ve* -r)
error: cannot lock ref 'refs/remotes/origin/feat/verify-?email': Unable to create '/Users/marcus/Documents/Workspace/proak-website/.git/refs/remotes/origin/feat/verify-?email.lock': Illegal byte sequence
error: Error deleting remote-tracking branch 'origin/feat/verify-?email'