Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
760 views
in Technique[技术] by (71.8m points)

github - git fatal not a git repository (or any of the parent directories) .git

fatal not a git repository (or any of the parent directories) .git is the error I'm getting when I try to perform any git operation on my repo. I made some changes to my project which is the repo then I try to git status to look over my changes and encounter this error. I Googled this error but didn't make any progress. It seems this error is most common when trying to perform git operations in a directory that's outside the repo which isn't the case for me. Also I tried checking my ./git/HEAD and ./git/logs/refs/heads both of which are empty files. ./git/logs/refs/remotes/origin/master is also empty.

So from the beginning:

  • I made an Android project in this directory on one computer.
  • I initiated a git on this directory and posted it on github.
  • I followed the usual online guides for pulling this repo onto 2 other computers.
  • Made some changes on another computer, pushed the changes to the repo.
  • Then on the original computer I successfully pulled the changes.
  • After not working on the project for a few days, I made some changes on the original computer, tried to git status and this happens.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In my case, accidentally .git/HEAD file was messed up with non unknown characters, but .git/ORIG_HEAD file was ok (it has commit id). So, I copied .git/ORIG_HEAD content to .git/HEAD file. Then restarted IDE (Aptana) and everything worked fine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...