atom / github

:octocat: Git and GitHub integration for Atom
https://github.atom.io
MIT License
1.12k stars 394 forks source link

Atom shows Create Repository while opening existing repo #2090

Open mkungla opened 5 years ago

mkungla commented 5 years ago

Prerequisites

Description

When opening existing repo in latest atom Create Repository panel is shown.

Steps to Reproduce

  1. Fedora 29 fresh install and latest atom
  2. open existing repo in atom

Expected behavior: Atom to recognize git repo

Actual behavior: Atom does not recognize git repo and prompts to Create Repository which results error Unable to initialize git repository in $PROJECT_PATH, This directory already contains a git repository

Reproduces how often: 100%

Versions

Atom    : 1.36.0
Electron: 2.0.18
Chrome  : 61.0.3163.100
Node    : 8.9.3

apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.36.0
python 2.7.15
git 2.20.1
mkungla commented 5 years ago

I had atom open in background and did all the git magic from cli. Some point atom suddenly recognized that it has existing repo open and started behaving as expected. Dunno can that be debugged or this issue can be closed!?

rsese commented 5 years ago

Thanks for the update @mkungla! I was unable to reproduce on Fedora 27 after installing 1.36.0 via the .rpm file - do things look ok if you open some other git repository? If so, then I think we can probably close for now, we can always reopen if you start hitting this error again.

glw commented 5 years ago

Im getting the same thing on new install on Ubuntu. Xenial Atom 1.38.2 x64 Electron 2.0.18 Chrome 61.0.3163.100 node v8.9.3 github 0.29

I didnt see anything user specific settings in the github settings panel in atom.

mkungla commented 5 years ago

It seems that it is some unidentified bug then! So now there is need to find a way how to reproduce that.

cfclindsey commented 5 years ago

I ran into something similar (maybe related?) but found a strange workaround.

Atom: 1.39.1 Git: 2.22.0 MacOS 10.14.5

  1. Closed Atom. Re-opened.
  2. Navigated to my project and opened files nested in a number of sub-folders.
  3. Saved changes to files.
  4. Got the "Create Repository" pane.
  5. Out of curiousity, I tried to create a repo and it told me:
    
    Unable to initialize git repository in /Users/lindsey/github/projectname

This directory already contains a git repository


6. I'm still able to work with the repo via CLI at this point.
7. Configuration files look as expected.
8. Create a file at the top of the tree called "test.txt." (/Users/lindsey/github/projectname/test.txt)
9. When viewing my test file, the git pane shows my repo. I can use the git functionality at this level just fine.
10. Navigate back to the files that I'm working on (/Users/lindsey/github/projectname/development/subfolder/subfolder...) and the "Create Repository" pane is there.  Save changes to files.
11. Open the tab with my test file... changes to the files show, I can stage, commit, and push them just fine.

For right now, I'm just pulling up that test file so that I can use the git functionality.  It's not ideal but it's better than having to use CLI for everything.

Something about it not recognizing the repo when in subfolders in the tree?

EDIT: I can confirm that this exact thing happens with other projects in Atom.  It's not isolated to this single project repo.
jpivarski commented 5 years ago

Atom: 1.40.0 Git: 2.17.1 Ubuntu 18.04

I've been seeing this issue, too. If a file's pane is active (i.e. has keyboard focus) in any file that was included in git at the time that I opened Atom, I see the correct git panel. If I'm in a file that was added later, I see the blank "Create Repository" panel. Because of this, I usually have to quit Atom and restart it whenever I add a file to the git repository. Quitting and restarting makes it recognize what git already knows: that the file is included in git.

This smells very strongly of an out-of-date initialization—Atom must be reading the git metadata at startup, perhaps when a project window is opened, and not thereafter. At least, it doesn't update the set of git-tracked files. (It does update the branch name, Fetch/Pull/Push button, and number of unstaged changes indicstor at the bottom right.)

robertandrews commented 5 years ago
  1. Create a file at the top of the tree called "test.txt." (/Users/lindsey/github/projectname/test.txt)
  2. When viewing my test file, the git pane shows my repo. I can use the git functionality at this level just fine.

I can confirm - creating an arbitrary file in the directory seemed to wake up the GitHub panel, which then asked for the authentication token.

NB. I had recently updated OS to Mojave and other web searches told me I needed to re-add git.