question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Not a git repository" error in Cygwin

See original GitHub issue

pre-commit install seems to have worked fine, but when executing pre-commit run I run into the following problem:

$ pre-commit run
[INFO] Initializing environment for git://github.com/pre-commit/pre-commit-hooks.
An unexpected error has occurred: CalledProcessError: Command: ['git', 'reset', 'v0.4.2', '--hard']
Return code: 128
Expected return code: 0
Output: (none)
Errors:
    fatal: Not a git repository (or any of the parent directories): .git


Check the log at ~/.pre-commit/pre-commit.log

This is a Windows machine, inside a Cygwin shell, with 1.9.4.msysgit.2 and Python 2.7.10.

Obviously this is working just fine on my colleagues’ computers who are on Macs 😢

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Mar 20, 2016

Sounds great! Glad to help 😃

I’ve opened #354 to at least make this error case more obvious – I’ll see if I can’t make it easy to “just work” in these cases, barring that I’ll at least add an error message in the short term.

Thanks again for the great bug report and useful debugging information!

0reactions
sverhagencommented, Mar 20, 2016

I installed that and will try using that for now, and cross other bridges if I were to run into further Git problems. It’s a while ago I had these problems, they’ve had some time to improve 😉 Thanks for you quick support throughout this process. My company is starting to use pre-commit as the outcome of a hackathon, and we’re excited about it, but it’s good to know there’s some “community support” when needed 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git error - Fatal: Not a git repository and how to fix it | Datree.io
This error means you attempted to run a Git command, but weren't inside a Git repository. Make sure you've: Navigated to the right...
Read more >
'X' does not appear to be a git repository (I'm sure the path is ...
It is my experience that cygwin passes the wrong path style to msysgit. Msysgit doesn't understand /cygdrive and therefore messes it up, except ......
Read more >
git can not access remote repository anymore after cygwin+git ...
Commands such as "git pull" or "git push" result into the error fatal: Could not read from remote repository. Please make sure you...
Read more >
How to Fix the “fatal: not a git repository” Error - ContainIQ
In short, the fatal: not a git repository error indicates that your current working directory isn't tracked by Git. If you find yourself...
Read more >
Cloning GitHub repository gives errors about cygwin1.dll version
This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found