在mac上从git仓库中移除一个奇怪的文件 [英] Removing a weird file from git repository on mac

查看:219
本文介绍了在mac上从git仓库中移除一个奇怪的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试将OpenEars框架添加到我的xcode项目中,当我尝试将我的项目提交到存储库时,出现以下错误:


error:pathspec'Framework / Icon \r'与git已知的任何文件都不匹配。


我试图使用xcode中的导航树来查找此文件,但它不存在。在磁盘上有一个物理文件,它是0字节(这很可能是问题),我试图在不影响的情况下删除它。



我尝试使用终端导航到文件并使用git rm Icon \r,但是由于名称中的\无法找到文件:

  $ git rm Icon \\r 
fatal:pathspec'Framework / OpenEars.framework / Icon \r'不匹配任何文件

有没有人有类似的问题或知道如何删除此文件阻止我推送任何改变。 试试 cd ing进入目录下,然后开始输入以下内容,直至到达 Icon \r 中的 I 。然后按Tab键使终端自动完成路径的其余部分。它看起来像这样:
$ b $ p $ g $ rm Framework / OpenEars.framework / Icon ^ M

$ b:b

注意:M之后有一个空格。进入这个完整路径似乎不起作用:只允许终端为您自动填充路径。



我得到了:

  MacPro:OpenEarsDistribution mdouma46 $ git rm Framework / OpenEars.framework / Icon ^ M 
'm'框架/ OpenEars.framework /图标
MacPro:OpenEarsDistribution mdouma46 $ git status
分支主
#要提交的更改:
#(

#deleted:Framework / OpenEars.framework / Icon \r


I recently tried adding the OpenEars framework to my xcode project, and when I tried to commit my project to the repository I get the following error:

error: pathspec '"Framework/Icon\r"' did not match any file(s) known to git.

I have tried to find this file using the navigation tree within xcode but it doesn't exist. There is a physical file on the disk which was 0 bytes (this is most likely the problem), and I tried removing this with no affect.

I tried to navigate to the file using terminal and use git rm Icon\r but due to the \ in the name it cannot find the file:

$ git rm Icon\\r
fatal: pathspec 'Framework/OpenEars.framework/Icon\r' did not match any files

Has anyone had a similar issue or know how I can remove this file as it is stopping me from pushing any changes.

解决方案

Try cding into the directory, then start typing the following until you get to the I in Icon\r. Then press the Tab key to have the Terminal automatically complete the rest of the path. It will look like this:

git rm Framework/OpenEars.framework/Icon^M

NB: There is a space after the M. Entering in this full path does not seem to work: only allowing the Terminal to autocomplete the path for you will.

I got:

MacPro:OpenEarsDistribution mdouma46$ git rm Framework/OpenEars.framework/Icon^M 
'm 'Framework/OpenEars.framework/Icon
MacPro:OpenEarsDistribution mdouma46$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   deleted:    "Framework/OpenEars.framework/Icon\r"
#

这篇关于在mac上从git仓库中移除一个奇怪的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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