glab icon indicating copy to clipboard operation
glab copied to clipboard

.gitconfig credential helper path does not work on Windows

Open clemsbot opened this issue 4 years ago • 2 comments

By chrullrich (@chrullrich),


Description

When creating a repository (on a self-hosted instance) and selecting to configure Git to access it, the resulting entry in ~/.gitconfig does not work.

Expected Behavior vs Actual Behavior

  • Expected behavior: Git can access the repository.
  • Actual behavior:

git push gitlab master [...]\glab_1.17.0_Windows_x86_64\bin\glab.exe auth git-credential get: [...]glab_1.17.0_Windows_x86_64binglab.exe: command not found Username for 'https://my.gitlab.instance':

Possible Fix

From .gitconfig:

[credential]
helper =

[credential "https://my.gitlab.instance"]
helper =
helper = ![...]\\glab_1.17.0_Windows_x86_64\\bin\\glab.exe auth git-credential

The problem was fixed after doubling the already doubled backslashes; i.e. this works:

[credential]
helper =

[credential "https://my.gitlab.instance"]
helper =
helper = ![...]\\\\glab_1.17.0_Windows_x86_64\\\\bin\\\\glab.exe auth git-credential

Steps to Reproduce

  1. Download the .zip release of GLab and extract. Put on PATH.
  2. glab auth login with a token provided by the self-hosted GitLab instance.
  3. glab repo create myrepo. Choose to configure Git to authenticate with GitLab credentials.
  4. git remote add gitlab https://my.gitlab.instance/me/myrepo
  5. git push gitlab master

Your Environment

  • Version used (Run glab --version): glab version 1.17.0 (2021-05-14)
  • Operating System and version: Windows
  • Git: 2.31.1.windows.1

Last updated: 2021-06-27T16:54:07.989Z

https://gitlab.com/profclems/glab/-/issues/278

clemsbot avatar Jun 27 '21 17:06 clemsbot

The bot that imported the bug lost one set of backslashes. The "possible fix" section should read:

From .gitconfig:

[credential]
helper =

[credential "https://my.gitlab.instance"]
helper =
helper = ![...]\\glab_1.17.0_Windows_x86_64\\bin\\glab.exe auth git-credential

The problem was fixed after doubling the already doubled backslashes; i.e. this works:

[credential]
helper =

[credential "https://my.gitlab.instance"]
helper =
helper = ![...]\\\\glab_1.17.0_Windows_x86_64\\\\bin\\\\glab.exe auth git-credential

chrullrich avatar Jul 05 '21 12:07 chrullrich

This issue has been automatically marked as stale because it has not had recent activity. We haven't had the time to address it yet, but we want to keep it open. This message is just a reminder for us to help triage issues.

clemsbot avatar Aug 06 '21 02:08 clemsbot