如何解决“警告:忽略名称不正确的ref”在混帐? [英] How to fix "warning: ignoring ref with broken name" in git?

查看:925
本文介绍了如何解决“警告:忽略名称不正确的ref”在混帐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发OSX。在特定的回购协议中,每当我在输入git命令后自动完成选项卡:

  $ git diff [点击标签...] 

我现在看到很多警告:

 警告:忽略带有错误名称的参考refs / Icon 
警告:忽略带有错误名称的参考refs / heads / Icon
警告:忽略带有错误名称参考的ref /遥控器/图标
警告:忽略ref名称为refs /遥控器/ origin / Icon
警告:忽略ref名称为refs / tags / Icon

这真的很烦人,这意味着我看不到我想看到的文件名。



<如何删除或取消这些警告?



我的图标?在我的 gitignore 文件。本地目录中有一个图标?文件。



对于所有触发器快乐的人来说,点击重复:我搜索了其他答案,我发现这个,但我不知道它是如何与我的情况。这可能是因为基本原因是一样的,但是如果解释如何解决这个问题,我和其他人将会受益。 更改文件夹的图标


如何删除或取消这些警告?


您需要删除违规文件本身。


我有一个图标条目?在我的gitignore文件中。


这没什么区别。一个 .gitignore 在工作目录上工作;这些文件位于Git存储其元数据的存储库文件夹内。 .gitignore 不适用于此。 Git会将它们误认为分支名称。



要解决这个问题,您可能会删除您给文件夹的自定义图标。但是,如果没有,您需要从 .git 文件夹下移除文件。您可以在Finder中执行此操作(打开显示隐藏文件后)或从命令行执行:

  rm .git /裁判/图标? 

请务必在尝试此操作前备份您的存储库 .git 文件夹可能会损坏您的存储库。


I'm working on OSX. In a particular repo, whenever I tab to autocomplete after typing a git command:

$ git diff [clicks tab...]

I now see a huge number of warnings:

warning: ignoring ref with broken name refs/Icon
warning: ignoring ref with broken name refs/heads/Icon
warning: ignoring ref with broken name refs/remotes/Icon
warning: ignoring ref with broken name refs/remotes/origin/Icon
warning: ignoring ref with broken name refs/tags/Icon

It's really annoying, and it means that I can't see the filenames I want to see.

How can I remove or suppress these warnings?

I have an entry for Icon? in my gitignore file. There is an Icon? file in the local directory.

For all the trigger-happy people about to click "duplicate": I've searched for other answers, I found this but I'm not sure how it relates to my situation. It may be that the underlying cause is the same, but it would benefit me and others to have an explanation of how to fix this problem.

解决方案

The Icon\r file is created by Mac OS when you change a folder's icon.

How can I remove or suppress these warnings?

You need to delete the offending files themselves.

I have an entry for Icon? in my gitignore file.

That makes no difference. A .gitignore works on the working directory; these files are inside the repository folder where Git stores its metadata. .gitignore does not apply there. Git is mistaking them as branch names.

To fix this problem, you may be able to remove the custom icon you gave your folder(s). But if not, you will need to remove the files from beneath the .git folder. You can do this in Finder (after turning on "Show Hidden Files") or from the command line:

rm .git/refs/Icon?

Make sure to backup your repository before attempting this as changing things in the .git folder can corrupt your repository.

这篇关于如何解决“警告:忽略名称不正确的ref”在混帐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆