FredrikNoren / ungit

The easiest way to use git. On any platform. Anywhere.
MIT License
10.43k stars 636 forks source link

Repeatedly asked for remote credentials #1413

Open gisforgabriel opened 4 years ago

gisforgabriel commented 4 years ago

Issue

I've used ungit for a long time on MacOS and never had an issue. I tried installing it on Windows 10 today and am being repeatedly asked for credentials, resulting in errors like this:

2020-08-27T12:31:50.969Z - warn: err during remote fetch for /refs remote: HTTP Basic: Access denied {
"isGitError":true,
"errorCode":"unknown",
"command":"-c color.ui=false -c core.quotepath=false -c core.pager=cat -c core.editor=: -c credential.helper=C:/Users/**my username**/AppData/Roaming/npm/node_modules/ungit/bin/credentials-helper 0 8448 origin fetch origin",
"workingDirectory":"C:\\**my directory**",
"error":"remote: HTTP Basic: Access denied\nfatal: Authentication failed for 'https://gitlab.com/**my repo**/'\n",
"message":"remote: HTTP Basic: Access denied",
"stderr":"remote: HTTP Basic: Access denied\nfatal: Authentication failed for 'https://gitlab.com/**my repo**.git/'\n",
"stdout":"",
"stdoutLower":"",
"stderrLower":"remote: http basic: access denied\nfatal: authentication failed for 'https://gitlab.com/**my repo**/'\n"}
2020-08-27T21:16:21.488Z - warn: Responding with ERROR:  "{\
"isGitError\":true,\
"errorCode\":\"unknown\",\
"command\":\"-c color.ui=false -c core.quotepath=false -c core.pager=cat -c core.editor=: config --get remote.origin.url\",\
"workingDirectory\":\"C:\\\\Users\\\\**my directory**",\
"error\":\"\",\
"message\":\"\",\
"stderr\":\"\",\
"stdout\":\"\",\
"stdoutLower\":\"\",\
"stderrLower\":\"\
"}"

Goal

I am trying to connect to a GitLab private repository, using a username and personal access token in Firefox on Windows.

Steps to recreate

Method 1

  1. Try to clone a private GitLab repository using Clone a git repository into a subfolder of ....
  2. Error logged in console. (No credentials request.)

Method 2

  1. Clone same repository with another application (Fork).
  2. Navigate to folder in ungit.
  3. Remote origin requires authentication modal appears on page load.
  4. Enter credentials (username / personal access token).
  5. Modal disappears. Error is logged. Modal appears again.
  6. etc

Attempts to resolve

I've upgraded git, Node.js and npm to the latest versions and have tried the Node.js and Electron builds with the same results.

This is a bit of a stab in the dark - I suspect this isn't an ungit issue, as it's pretty much the same behaviour in git-gui which is bundled with git on Windows. Any help appreciated and can close this ticket if it goes stale.

ylecuyer commented 4 years ago

You could try to clone with ssh and use your ssh-agent to handle your key. This way you wont have to login anymore

On Thu, 27 Aug 2020, 23:56 gisforgabriel, notifications@github.com wrote:

Issue

I've used ungit for a long time on MacOS and never had an issue. I tried installing it on Windows 10 today and am being repeatedly asked for credentials, resulting in errors like this:

2020-08-27T12:31:50.969Z - warn: err during remote fetch for /refs remote: HTTP Basic: Access denied {"isGitError":true,"errorCode":"unknown","command":"-c color.ui=false -c core.quotepath=false -c core.pager=cat -c core.editor=: -c credential.helper=C:/Users/my username/AppData/Roaming/npm/node_modules/ungit/bin/credentials-helper 0 8448 origin fetch origin","workingDirectory":"C:\my directory","error":"remote: HTTP Basic: Access denied\nfatal: Authentication failed for 'https://gitlab.com/**my repo/'\n","message":"remote: HTTP Basic: Access denied","stderr":"remote: HTTP Basic: Access denied\nfatal: Authentication failed for 'https://gitlab.com/my repo.git/'\n","stdout":"","stdoutLower":"","stderrLower":"remote: http basic: access denied\nfatal: authentication failed for 'https://gitlab.com/my repo**/'\n"}

2020-08-27T21:16:21.488Z - warn: Responding with ERROR: "{\"isGitError\":true,\"errorCode\":\"unknown\",\"command\":\"-c color.ui=false -c core.quotepath=false -c core.pager=cat -c core.editor=: config --get remote.origin.url\",\"workingDirectory\":\"C:\\Users\\my directory",\"error\":\"\",\"message\":\"\",\"stderr\":\"\",\"stdout\":\"\",\"stdoutLower\":\"\",\"stderrLower\":\"\"}"

Goal

I am trying to connect to a GitLab private repository, using a username and personal access token in Firefox on Windows. Steps to recreate:

1.

Try to clone a private GitLab repository using Clone a git repository into a subfolder of .... 2, Error logged in console. (No credentials request.) 2.

Clone same repository with another application (Fork). 3.

Navigate to folder in ungit. 4.

Remote origin requires authentication modal appears on page load. 5.

Enter credentials (username / personal access token). 6.

Modal disappears. Error is logged. Modal appears again. 7.

etc

Attempts to resolve

I've upgraded git, Node.js and npm to the latest versions and have tried the Node.js and Electron builds with the same results.

This is a bit of a stab in the dark - I suspect this isn't an ungit issue, as it's pretty much the same behaviour in git-gui https://github.com/prati0100/git-gui which is bundled with git on Windows. Any help appreciated and can close this ticket if it goes stale.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/FredrikNoren/ungit/issues/1413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOHYOJ2RPMOABF4LWQM2DTSC3JAHANCNFSM4QNOTWSA .

gisforgabriel commented 4 years ago

Thanks, I'm not stuck unable to work with my repository as an alternative system works. It would just be great to continue my totally painless experience of ungit on MacOS on Windows.

Strangely I've re-run the Method 1 as above, but with a different result. This time ungit successfully cloned the repository and reloaded the page to show the graph for the repository. However, it straight away opens the authentication modal and returns to the behaviour in Method 2.

jung-kim commented 3 years ago

Does gitlab support ssh based connection like github?

If so, you can just do ssh-add -K to cache auth and ungit will not ask for auth again