Git identity prompt always appears
cvande04 opened this issue ยท 10 comments
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=โ&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
(note: previously mistakenly posted within https://github.com/atom/atom/issues/21687)
Hello, I am a long-time Atom user but a first-time poster. I ran into a novel bug earlier today regarding the Git package, specifically the Git identity prompt. Please let me know if the description of the problem is unclear in any way:
The Git Identity prompt appears every time I open the Git panel in Atom. It asks me to enter my Git username and email. However, I have run both git config --global user.name
and git config --global user.email
(including prior to the bug manifesting) and double-checking the config file shows that the values are set properly:
[user]
name = (my username)
email = (my email)
[github]
user = (my username)
For a file in a repository that is initialized on Github, the Git identity panel often (but not always) pre-populates the fields with my username and email as found in the config file. For a file in a repository that has not been initialized, the name and email address fields are blank. Switching between two repositories, regardless of whether they are initialized or not, often (but not always) results in the Git identity prompt reappearing, even if I have just used it to sign in moments before switching, and even if I can initially see the Git panel for a few moments before the identity prompt appears. Sometimes, the identity panel will flicker rapidly back-and-forth between having the fields pre-populated and having them blank over the course of a few seconds. After this, trying to re-enter my username or email in the fields often results in glitches, where the character I typed appears in the field for a fraction of a second before vanishing as if I had hit the backspace key. I have tried everything in the debugging guide, including uninstalling/reinstalling Atom and disabling/re-enabling the Git package, as well as re-entering the git config --global
values for name and email and repeatedly restarting my computer.
My guess is that it has something to do with my Git credentials, given that it is the Git identity prompt that glitches and that sometimes the fields are not pre-populated with my name and email as I have them configured, but for the life of me I cannot figure out what it is. Running git config user.name
or git config user.email
brings up the correct values, regardless of repository. I do not have any local configs (i.e. I do not have git config username
without the global flag to set any values in any of the repositories in question). Any help would be appreciated; the bug is interrupting my workflow and (in some cases) preventing me from using Atom's Git interface entirely.
Steps to Reproduce
- Open Atom
- Open a file from a repository
- Open Git tab
4 (optional). Switch between files in different repositories.
Expected behavior:
Git tab (unstaged/staged changes, commit message field, list of past commits) is displayed.
Actual behavior:
Git identity panel is displayed, sometimes after a few seconds of seeing the Git tab and sometimes not; sometimes with the fields pre-populated with my username and email and sometimes not.
Reproduces how often:
95% (occasionally, switching between files of two different repositories that are both initialized will not cause the prompt to reappear).
Versions
Atom : 1.53.0
Electron: 6.1.12
Chrome : 76.0.3809.146
Node : 12.4.0
apm 2.5.2
npm 6.14.8
node 12.4.0 x64
atom 1.53.0
python 2.7.8
git 2.22.0.windows.1
visual studio
OS Name: Microsoft Windows 10 Home
Version: 10.0.19041
Additional Information
I should note that one of the repositories is linked to Heroku, although the error is not exclusive to that one repository.
Can confirm. With Atom 1.53, it has seem to gotten worse. It is making it hell to work with 2 different profiles even after properly setting up global and local user names. Moreover, it is overwriting a 444 .gitconfig file over & over.
To add to this, v0.36.2 isn't as bad, probably due to #2437. But it is still messing up global & local identities a lot.
Eg. I have global gitconfig (~/.gitconfig) setup with my personal email & a conditional include gitconfig setup with my work email (refer https://stackoverflow.com/a/43654115). Whenever I switch from a work repo to personal repo, it automatically writes it to the global .gitconfig. This should NEVER happen.
On top of that, I've chmod 444 both gitconfigs, but it is still overwriting it. Again, this should NEVER happen.
I haven't spent much time with the latest version, but it should be modified to only write when "continue" button is clicked,
I have a similar experience, but my Git identity prompt does not flicker. Maybe my experience can help track down the root issue:
I have global user.name and user.email Git configs set. For me, the Git identity prompt appears when switching to view a file in a non-Git project folder, which I think is new behavior, and makes sense.
However when I switch back to viewing a file in a Git repo project folder, the Git view shows the Git identity prompt with my global config settings prepopulated and I have to click Continue to move forward. I switch between viewing files in a non-Git folder and a Git repo often, so having to click Continue each time I switch files is quite disruptive.
Note: this is with "Follow the active pane item" setting on (the padlock in the top right unlocked) in the Git view. By unsetting this option, the problem is not as bad -- it only occurs if I manually switch to a non-Git folder using the dropdown menu (which I would never need to do). @cvande04, as a partial workaround, it may help you to unset the "Follow the active pane item" option (click the padlock), with the caveat that you would then have to manually switch between repos using the dropdown.
For me, the Git identity prompt appears when switching to view a file in a non-Git project folder [..]
Ahhh this is an interesting detail. I bet I'm still not handling projects without a git repo properly. Thanks for providing that information, that's helpful.
@smashwilson can confirm every time I open a file not tracked in a git repo, this identity prompt reappears once I'm back in a file tracked by git. Rather annoying, would be great to have a fix soon.
Eg. I have global gitconfig (~/.gitconfig) setup with my personal email & a conditional include gitconfig setup with my work email...
As noted by @utkarshgupta137, this is a potentially harmful issue.
In ~/.gitconfig
, I explicitly set user.useconfigonly
to true
, user.name
to <my name>
, and do not set user.email
. That way, I can ensure that I use my name for all commits, but individual email addresses for different repositories. Like private and work addresses.
However, as above configuration is overwritten each time I launch Atom, I risk to use the wrong email address. At least for locally cloned repositories where I haven't set my email address yet.
Moreover, it is overwriting a 444 .gitconfig file over & over.
And as noted by @utkarshgupta137, too, running chmod a-w ~/.gitconfig
does not help. Atom does not respect the config file's permissions and writes to the file anyhow.
To cut a long story short, I would really appreciate fixing this issue soon.
In what version will be this implemented?
I still have this issue on Windows 10, Atom 1.54.0
@nelson6e65 I'm having the same issue as you on 1.54.0. Apparently, this has been now addressed with #2594 (comment)