首页 > 解决方案 > Git 错误:与 git 已知的任何文件都不匹配

问题描述

我不得不重新安装 Visual Studio,因为这是我第一次需要使用 Web Deploy 在我们的 Azure 实例(Episerver 网站)上部署我的代码,所以我不得不重新输入我的登录信息。

在 Git 中,我现在看到以下状态(注意这是指 FTP):

修改:
Project/Project.Site/Properties/PublishProfiles/a1di01mstr04ixqinte - FTP.pubxml

由于我们不使用 FTP,我不希望提交任何这些更改。事实上,在 Visual Studio 中,没有任何文件显示为已更改。

我试图通过执行以下操作不签出此文件:

git checkout -- Project/Project.Site/Properties/PublishProfiles/a1di01mstr04ixqinte

但我得到了错误:

错误:pathspec 'Project/Project.Site/Properties/PublishProfiles/a1di01mstr04ixqinte' 与 git 已知的任何文件都不匹配

标签: gitvisual-studioazureepiserver

解决方案


我猜您没有提供git checkout命令的完整路径,因为错误消息中缺少“-FTP.pubxml”。如果您有带空格的路径,则应使用引号。

git checkout -- "Project/Project.Site/Properties/PublishProfiles/a1di01mstr04ixqinte - FTP.pubxml"


推荐阅读