Atom not recognizing git repository


#1

I have been working on a project in atom that is a git repository. When I would open it previously Atom would automatically detect changes and let me know (in the bottom right hand corner) how many commits I was ahead of the main branch, and also change the file color, etc. I would also use the package Git-plus to work directly with git from Atom.

Now, for some reason Atom isn’t recognizing my project as a git repository. The files don’t change colors, I don’t see how far ahead I am, and also, when I invoke Git-plus with cmd-shift-H, the only option I see is ‘init’–i.e. it’s not seeing a repository.

I already checked and I’m still able to use git from the terminal with these files. I also have Git Desktop installed and I can commit, push, and pull with these files from there too.

Any help would be greatly appreciated!


#2

Quick update: I noticed that if I created a new folder on my desktop and initiated a git repository in there, then atom was able to recognize it.
The only thing is I’m not sure what’s different at all about the project I’m working in. It’s in a folder called github with individual folders in there that contain the repositories. What am I doing wrong?


#3

Atom will only recognize a project as a git repository when it is the top level folder in the tree view. So when you have a folder opened that is not a repository of itself, but that contains multiple repositories, Atom won’t do all its git related stuff. My guess is that git-plus uses the same information as Atom or performs similar checks.


#4

I am having this same problem. I am in the top-level directory of my repo in Atom but neither Atom nor git-plus seem to recognize the repo.

However, I am using git with an external directory. Thus, I have a file called .git in the top-level directory for which contains

gitdir: ../.project.git

And then in .project.git, there’s the config option core.worktree = /path/to/project

Git sees this all fine from the command line, but Atom and git-plus do not.


#5

@noamross, I believe this is being tracked by:

Let me know if I got it wrong.


#6

That’s right, thanks!


#7

Rather than explicitly checking for a .git directory, wouldn’t it be better to use:

git rev-parse --is-inside-work-tree