Git error: did not match any file(s) known to git

Git error: did not match any file(s) known to git

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

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

modified:
Project/Project.Site/Properties/PublishProfiles/a1di01mstr04ixqinte - FTP.pubxml

因为我们没有使用 FTP,所以我不希望进行任何这些更改。事实上 Visual Studio none 中的文件显示已更改。

我试图通过以下方式不签出此文件:

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

但我收到错误消息:

error: pathspec 'Project/Project.Site/Properties/PublishProfiles/a1di01mstr04ixqinte' did not match any file(s) known to git

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

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