简体   繁体   English

为什么我收到错误“致命:'C:/ Program Files(x86)/ Git'在存储库外”当我从存储库中运行“git reset --hard~1”时?

[英]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.

相关问题 为什么在 git 工作树中查找顶级目录时会出现“fatal: not a git repository...”? - Why am I getting `fatal: not a git repository...` when looking up toplevel dir in a git worktree? 为什么我会致命:文件来自Jenkins的存储库 - Why am I getting fatal: file is outside repository from Jenkins 为什么在运行git reset --hard HEAD时出现“未跟踪文件”错误? - Why am I getting “Untracked files” error upon running git reset --hard HEAD? 当我在git命令提示符下键入“ git add”时,收到致命消息,即不是git存储库。 - I am getting fatal message i.e not a git repository, when I am typing “git add .” in git command prompt. 我无法运行任何 git 命令(“不是 git 存储库”错误) - I am unable to run any git commands (“not a git repository” error) 当我运行git archive时,为什么会出现“远程:致命:找不到路径:HEAD”错误? - Why am I getting “remote: fatal: path not found: HEAD” error when I run git archive? 在git reset --hard HEAD储存库中还原文件 - Restore files in a git reset --hard HEAD repository 程序文件的git命令(x86) - git command for Program FIles (x86) “git add”返回“fatal: external repository”错误 - “git add” returning “fatal: outside repository” error Teamcity:无法在代理上执行checkout:无法在路径C上运行git:\\ Program Files(x86)\\ Git \\ bin \\ sh.exe - Teamcity: Failed to perform checkout on agent: Unable to run git at path C:\Program Files (x86)\Git\bin\sh.exe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM