Open smashwilson opened 7 years ago
Yes please! I ran into this today and only know how to log in thanks to your issue. Here's what I've experienced:
There are deeper issues with push and pull when using the Github package in Atom on a Mac. I created a personal access token. And I entered that the next time I got the login overlay. But it didn't work. Each time I push, I get the log-in overlay. And I usually have to enter my username and password (or keychain) three times before the push works.
I tried changing the password in the atom-github keychain in keychain access, to my new personal access token. Still no luck.
Interesting - the GitHub desktop app accesses a different Keychain. It picked up the (pre-existing?) GitHub for Mac SSH keychain. That keychain is similar to another keychain called github.com/mac. Note - I have no problem pushing and pulling via the GitHub desktop app on Mac. Perhaps the GitHub package for Atom needs to add itself to that existing Keychain rather than creating its own Keychain. In other words, it needs to adopt the same authorisation method as the GitHub desktop app.
@cameronmcefee: "Repo" scope should be what you need for your token. Can you pull from the command-line with the same username and token?
@adrian3H: I agree, it's a little clunky right now.
And I usually have to enter my username and password (or keychain) three times before the push works.
This is odd. Are the first two pushes timing out or something? Do you get any other feedback in the git output from the error message?
Perhaps the GitHub package for Atom needs to add itself to that existing Keychain rather than creating its own Keychain. In other words, it needs to adopt the same authorisation method as the GitHub desktop app.
Right now the keychain is manipulated with the command-line git-credential-osxkeychain
helper. No reason we couldn't make sure that we re-use the same keychain credentials when we tackle #861, though.
For both of you: you can get more detailed diagnostic output for git commands by opening your dev console and running:
atom.config.set('github.gitDiagnostics', true)
That will cause git operations to run with GIT_TRACE=1
and dump the full stdout and stderr of each command to the dev console. That might be helpful to track down why your pushes are intermittently failing?
Thanks for your quick response.
Ok, I enabled git diagnostics and opened dev tools within Atom, did a push and then expanded Git:git-c. btw I have the git-credential-osxkeychain installed. I checked that.
This is weird. Once again I had to enter my username and password 3 times before the push worked. But the first two times I submitted, I didn't see an error in the console.
So I dug into the log.
There wasn't much inside Git:git-c:
git:git -c gpg.program=/Applications/Atom.app/Contents/Resources/app/node_modules/github/bin/gpg-no-tty.sh commit -m stage 2 - flex layout with space-around distribution on vertical axis in [path removed - my redaction - adrian3H]
NB - the account name I'm using is the account listed in the keychain 'GitHub for MacSSH key passphrase'. That account name is my own email address (provided by my company). I also have the one-word account name adrian3H, registered at GitHub. The password I'm using is the password (appears to be a token - long and alphanumeric) in that same keychain. However, the account listed in the 'atom-github' keychain is 'https://api.github.com' - i.e. NOT my own email address. I thought that might be significant but a colleague of mine, who is able to push via Atom, without a username/password prompt, also has his account listed in his 'atom-github' keychain as 'https://api.github.com'.
However it might be significant that my colleague's username in his keychain 'GitHub for MacSSH key passphrase' is not an email address, but his one-word account name (equivalent to my adrian3H).
It might also be significant that in the preferences of GitHub Desktop app, in the advanced tab, I see both my email address and my one-word account name listed against 'Git Config'. Is it possible that GitHub Desktop tries both usernames, whereas Atom's integrated GitHub packages only tries one?
Note also that I recently copied the token from the keychain 'GitHub for MacSSH key passphrase' into the password field in the 'atom-github' keychain. I did that after striking this push issue in Atom.
I tried deleting my 'atom-github' keychain but the issue wasn't resolved. When I clicked 'login' in the 'git preview' pane, I entered my token in the password field (the only field) and everything appeared to go well. But the same keychain was recreated. And when I tried to push, I went through the same process of 3 logins before the login worked.
btw it doesn't matter whether I enter my email account name or my one-word account name, as my username in the overlay which appears on clicking 'push' in Atom. Push happens after 3 log-in attempts.
Anyway, I have just tried to push again. Same result. This time I've extract two blocks of code which I think are relevant to fetching credentials:
... [extract 1:]
10:53:18.860912 run-command.c:369 trace: run_command: '/private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/git-credential-atom.sh get' 10:53:18.864687 run-command.c:228 trace: exec: '/bin/sh' '-c' '/private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/git-credential-atom.sh get' '/private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/git-credential-atom.sh get' git-credential-atom: working directory = /Users/adrian.hall/source/rsvp git-credential-atom: socket path = /private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/helper.sock git-credential-atom: action = get git-credential-atom: parsed from stdin: [protocol] = [https] git-credential-atom: parsed from stdin: [host] = [github.com] git-credential-atom: all input received: EOF from stdin git-credential-atom: discover credential helpers from system git configuration git-credential-atom: PATH = /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin git-credential-atom: failed to list credential helpers. this is ok Error: Command failed: git config --system --get-all credential.helper
at ChildProcess.exithandler (child_process.js:218:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:493:12)
git-credential-atom: attempting to run fill with user-configured credential helpers git-credential-atom: GIT_ASKPASS = git-credential-atom: SSH_ASKPASS = git-credential-atom: arguments = credential fill git-credential-atom: stdin = protocol=https host=github.com
git-credential-atom: stdout:
git-credential-atom: stderr: 10:53:19.172389 git.c:369 trace: built-in: git 'credential' 'fill' fatal: could not read Username for 'https://github.com': terminal prompts disabled
git-credential-atom: user-configured credential helpers failed with exit code 128. this is ok git-credential-atom: requesting dialog through Atom socket git-credential-atom: prompt = "Please enter your credentials for https://github.com" includeUsername = true git-credential-atom: connection established git-credential-atom: writing payload git-credential-atom: payload written git-credential-atom: Atom socket stream terminated git-credential-atom: Atom reply parsed git-credential-atom: success 10:55:47.846106 http.c:638 == Info: Couldn't find host github.com in the .netrc file; using defaults 10:55:47.846143 http.c:638 == Info: Connection 0 seems to be dead! 10:55:47.846165 http.c:638 == Info: Closing connection 0 10:55:47.855446 http.c:638 == Info: Trying 192.30.255.112... 10:55:47.855467 http.c:638 == Info: TCP_NODELAY set 10:55:48.059448 http.c:638 == Info: Connected to github.com (192.30.255.112) port 443 (#1) 10:55:48.059547 http.c:638 == Info: SSL re-using session ID 10:55:48.493081 http.c:638 == Info: TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 10:55:48.493315 http.c:638 == Info: Server certificate: github.com
........... [extract 2:] :
10:55:49.317124 run-command.c:369 trace: run_command: '/private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/git-credential-atom.sh store' 10:55:49.318110 run-command.c:228 trace: exec: '/bin/sh' '-c' '/private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/git-credential-atom.sh store' '/private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/git-credential-atom.sh store' git-credential-atom: working directory = /Users/adrian.hall/source/rsvp git-credential-atom: socket path = /private/var/folders/rk/hhdyftqj6r5194ddw_hb8k2c0000gp/T/github-117522-31922-12i22js.tx6cxtuik9/helper.sock git-credential-atom: action = store git-credential-atom: parsed from stdin: [protocol] = [https] git-credential-atom: parsed from stdin: [host] = [github.com] git-credential-atom: parsed from stdin: [username] = [adrian.hall@rsvp.com.au] git-credential-atom: parsed from stdin: [password] = [**] git-credential-atom: all input received: EOF from stdin git-credential-atom: discover credential helpers from system git configuration git-credential-atom: PATH = /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin git-credential-atom: failed to list credential helpers. this is ok Error: Command failed: git config --system --get-all credential.helper
at ChildProcess.exithandler (child_process.js:218:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:493:12)
git-credential-atom: attempting to run approve with user-configured credential helpers git-credential-atom: GIT_ASKPASS = git-credential-atom: SSH_ASKPASS = git-credential-atom: arguments = credential approve git-credential-atom: stdin = protocol=https host=github.com username=adrian.hall@rsvp.com.au password=***
10:55:49.569201 run-command.c:369 trace: run_command: '.git/hooks/pre-push' 'origin' 'https://github.com/3HGroup/rsvp.git' 10:55:49.596713 git.c:594 trace: exec: 'git-lfs' 'pre-push' 'origin' 'https://github.com/3HGroup/rsvp.git' 10:55:49.597921 run-command.c:369 trace: run_command: 'git-lfs' 'pre-push' 'origin' 'https://github.com/3HGroup/rsvp.git' trace git-lfs: run_command: 'git' config -l trace git-lfs: run_command: 'git' version trace git-lfs: tq: running as batched queue, batch size of 100 trace git-lfs: creds: git credential fill ("https", "github.com", "3HGroup/rsvp.git") trace git-lfs: Filled credentials for https://github.com/3HGroup/rsvp.git trace git-lfs: HTTP: POST https://github.com/3HGroup/rsvp.git/info/lfs/locks/verify trace git-lfs: HTTP: 200 trace git-lfs: HTTP: {"ours":[],"theirs":[],"next_cursor":""}
trace git-lfs: pre-push: refs/heads/RSVP-7655 7c1d9a12e3a6a91f95801bf53367a92465c10c0a refs/heads/RSVP-7655 7edf1f4a0d760b4eb2f72ae446430cf955f1081a
trace git-lfs: run_command: git rev-list --objects --stdin --
trace git-lfs: run_command: git cat-file --batch-check
trace git-lfs: run_command: git cat-file --batch
trace git-lfs: tq: sending batch of size 0
10:57:42.907535 run-command.c:369 trace: run_command: 'send-pack' '--stateless-rpc' '--helper-status' '--thin' '--no-progress' 'https://github.com/3HGroup/rsvp.git/' '--stdin'
10:57:42.908591 exec_cmd.c:118 trace: exec: 'git' 'send-pack' '--stateless-rpc' '--helper-status' '--thin' '--no-progress' 'https://github.com/3HGroup/rsvp.git/' '--stdin'
10:57:42.912142 git.c:369 trace: built-in: git 'send-pack' '--stateless-rpc' '--helper-status' '--thin' '--no-progress' 'https://github.com/3HGroup/rsvp.git/' '--stdin'
10:57:42.941410 run-command.c:369 trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '-q'
10:57:42.942463 exec_cmd.c:118 trace: exec: 'git' 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '-q'
10:57:42.945804 git.c:369 trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '-q'
10:57:43.202303 http.c:638 == Info: Couldn't find host github.com in the .netrc file; using defaults
10:57:43.202349 http.c:638 == Info: Connection 1 seems to be dead!
10:57:43.202363 http.c:638 == Info: Closing connection 1
10:57:43.202666 http.c:638 == Info: NTLM-proxy picked AND auth done set, clear picked!
10:57:43.206612 http.c:638 == Info: Trying 192.30.255.113...
10:57:43.206637 http.c:638 == Info: TCP_NODELAY set
10:57:43.407676 http.c:638 == Info: Connected to github.com (192.30.255.113) port 443 (#2)
10:57:43.407825 http.c:638 == Info: SSL re-using session ID
10:57:43.611436 http.c:638 == Info: TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
10:57:43.619050 http.c:638 == Info: Server certificate: github.com
10:57:43.619159 http.c:638 == Info: Server certificate: DigiCert SHA2 Extended Validation Server CA
10:57:43.619233 http.c:638 == Info: Server certificate: DigiCert High Assurance EV Root CA
10:57:43.619260 http.c:638 == Info: Server auth using Basic with user 'adrian.hall@rsvp.com.au'
10:57:43.619339 http.c:585 => Send header, 0000000350 bytes (0x0000015e)
10:57:43.619352 http.c:597 => Send header: POST /3HGroup/rsvp.git/git-receive-pack HTTP/1.1
10:57:43.619358 http.c:597 => Send header: Host: github.com
10:57:43.619364 http.c:597 => Send header: Authorization: Basic
I hope that helps. Let me know if you'd like the complete dump. It's long. :)
I resolved the issue by installing git via homebrew, then adding export PATH="/usr/local/bin:${PATH}" to ~/.bash_profile and restarting.
Apparently, the Mac OSX (Xcode) version has a different path, and Atom's GitHub package din't know where to find it.
@smashwilson In my case, I think it was a case of lack of UI + user error. Just this week (about a month from the OP) I got a notification that one of the orgs I'm a member of approved Atom as a third-party GitHub application, so I'm guessing my push was blocked for that reason. It's been long enough that I forget which project I was trying to push to, but I'm willing to believe it was one for this org, since it's my day job. While I call this user error, it wasn't ever clear to me that Atom is a an app that needs org approval. It would have been great to get some sort of message that said "Hey, your org admin hasn't approved Atom yet".
Just adding myself here to track when this is fixed.
When pushing, pulling, or fetching against an HTTPS remote for a private repository while you have 2fa enabled, you need to provide a personal access token instead of your password to authenticate. We could stand to make this smoother, or at least hint about this in the UI text.