[英]Why am I getting error “fatal: 'C:/Program Files (x86)/Git' is outside the repository” when I run “git reset --hard ~1” from within the repository?
I'm running SourceTree on Windows 7 and when I open the MINGW32 command prompt from within the respository folder (at C:\\DEV\\Shayne\\Quarks) and try to delete the last commit by entering the command git reset --hard ~1
I get the error fatal: 'C:/Program Files (x86)/Git' is outside the repository
. 我在Windows 7上运行SourceTree,当我从存储库文件夹(在C:\\ DEV \\ Shayne \\ Quarks)中打开MINGW32命令提示符并尝试通过输入命令
git reset --hard ~1
删除最后一次提交我得到了fatal: 'C:/Program Files (x86)/Git' is outside the repository
的错误fatal: 'C:/Program Files (x86)/Git' is outside the repository
。 The title bar of the command prompt reads MINGW32:c/DEV/Shayne/Quarks
. 命令提示符的标题栏显示
MINGW32:c/DEV/Shayne/Quarks
。 I can't find any answers on Google and I've successfully run this command on this machine in the recent past. 我在Google上找不到任何答案,而且我最近在这台机器上成功运行了这个命令。 What is causing this error and how can I fix it?
导致此错误的原因是什么?如何解决?
You are typing a bad command. 您正在输入错误的命令。 You want to type
你想打字
git reset --hard head~1
I have no idea why git reports this error when you type just ~1
, but it does. 我不知道为什么当你输入
~1
时git报告这个错误,但确实如此。
Update: 更新:
This appears to happen because of tilde expansion . 这似乎是因为波浪扩展而发生的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.