Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magit not recognising git repositories

Tags:

git

emacs

windows

I'm currently trying to use Magit with Emacs 23.1 on Win7 64-bit but Magit does not recognise my git repositories. Please bear in mind I'm a complete Emacs newbie.

I run the magit-status command and it asks for a directory containing the repo, which I obviously type in and then it just says every time I try: "There is no Git repository in "e:/path/to/directory". Create one? (y or n)" when there definitely is a repository in there.

Has anybody else encountered this? I've read that it could possibly be that the actual git.exe can't be found and I've tried messing around with my Path variable but nothing I do is allowing Magit to recognise my repositories. Any ideas?

like image 763
KnackeredCoder Avatar asked Dec 02 '25 19:12

KnackeredCoder


1 Answers

magit runs the following command to find the .git directory:

git rev-parse --git-dir

I would first try if Emacs really sees your git binary. To do this, please open any file in your git repository in emacs. Next do M-x: shell-command and type the above git command in the prompt: git rev-parse --git-dir.

As output you should get something like .git. If you get 'git' is not recognized as an internal or external command, ..., then you need to make sure emacs/magit can find git. You do this by either customizing magit-git-executable (M-x: customize-variable) and point it to the absolute path or by making sure the git directory is in the Windows PATH (if you use msysgit you have been asked during installation).

Hope this helps!

Cheers, Daniel

like image 176
danielpoe Avatar answered Dec 04 '25 11:12

danielpoe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!