git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Problem with credential.helper=store in git 2.32.0.windows.2
@ 2022-01-06 12:32 Imi Admin
  2022-01-09 21:53 ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Imi Admin @ 2022-01-06 12:32 UTC (permalink / raw)
  To: git

Hi all,

i've filled out the bug report below, maybe you can help me...

Best Sebastian

*****************************************************************************

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

I sometimes have to use git commands on a remote Windows10 through a ssh 
shell (PowerShell Server, so powershell as the shell). I'm creating a 
credentials store file for these commands and set the local git 
configuration credential.helper=store to point to this file.
Here's my local git configuration:

PS C:\scripts> git config -l --show-origin
file:C:/Program 
Files/Git/etc/gitconfig	diff.astextplain.textconv=astextplain
file:C:/Program Files/Git/etc/gitconfig	filter.lfs.clean=git-lfs clean 
-- %f
file:C:/Program Files/Git/etc/gitconfig	filter.lfs.smudge=git-lfs smudge 
-- %f
file:C:/Program Files/Git/etc/gitconfig	filter.lfs.process=git-lfs 
filter-process
file:C:/Program Files/Git/etc/gitconfig	filter.lfs.required=true
file:C:/Program Files/Git/etc/gitconfig	http.sslbackend=openssl
file:C:/Program Files/Git/etc/gitconfig	http.sslcainfo=C:/Program 
Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:C:/Program Files/Git/etc/gitconfig	core.autocrlf=true
file:C:/Program Files/Git/etc/gitconfig	core.fscache=true
file:C:/Program Files/Git/etc/gitconfig	core.symlinks=false
file:C:/Program Files/Git/etc/gitconfig	core.editor="C:\\Program 
Files\\Notepad++\\notepad++.exe" -multiInst -notabbar -nosession 
-noPlugin
file:C:/Program Files/Git/etc/gitconfig	pull.rebase=false
file:C:/Program Files/Git/etc/gitconfig	credential.helper=manager-core
file:C:/Program 
Files/Git/etc/gitconfig	credential.https://dev.azure.com.usehttppath=true
file:C:/Program Files/Git/etc/gitconfig	init.defaultbranch=master
file:.git/config	core.repositoryformatversion=0
file:.git/config	core.filemode=false
file:.git/config	core.bare=false
file:.git/config	core.logallrefupdates=true
file:.git/config	core.symlinks=false
file:.git/config	core.ignorecase=true
file:.git/config	remote.origin.url=https://mygitlab.de/mygroup/myrepo.git
file:.git/config	remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config	branch.master.remote=origin
file:.git/config	branch.master.merge=refs/heads/master
file:.git/config	user.name=myname
file:.git/config	user.email=my@email
file:.git/config	credential.helper=store --file 
C:/scripts/.git/.git-credentials

What did you expect to happen? (Expected behavior)

I'd expect that a 'git pull' against my remote simply works without 
asking me for a user name and password.

What happened instead? (Actual behavior)

My ssh connection hangs...

What's different between what you expected and what actually happened?

Please see above and below...

Anything else you want to add:

My approach worked in a prior git for windows version.
When i use the same approach on the same remote Windows 10 client via 
RDP in Powershell, i see that *before* git uses the credential store 
file, it displays the windows credential dialog. If i click 'cancel' in 
the dialog, git uses the credential store file:

PS C:\scripts> git pull
09:33:11.471005 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/bin
09:33:11.471005 git.c:455               trace: built-in: git pull
09:33:11.471005 run-command.c:667       trace: run_command: git fetch 
--update-head-ok
09:33:11.486629 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:11.502137 git.c:455               trace: built-in: git fetch 
--update-head-ok
09:33:11.502137 run-command.c:667       trace: run_command: GIT_DIR=.git 
git remote-https origin https://mygitlab.de/mygroup/myrepo.git
09:33:11.517762 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:11.517762 git.c:744               trace: exec: git-remote-https 
origin https://mygitlab.de/mygroup/myrepo.git
09:33:11.517762 run-command.c:667       trace: run_command: 
git-remote-https origin https://mygitlab.de/mygroup/myrepo.git
09:33:11.611382 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:11.720731 run-command.c:667       trace: run_command: 'git 
credential-manager-core get'
09:33:11.783217 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:11.798838 git.c:744               trace: exec: 
git-credential-manager-core get
09:33:11.798838 run-command.c:667       trace: run_command: 
git-credential-manager-core get
fatal: User cancelled the authentication prompt.
09:33:22.955081 run-command.c:667       trace: run_command: 'git 
credential-store --file C:/scripts/.git/.git-credentials get'
09:33:22.970702 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:22.970702 git.c:455               trace: built-in: git 
credential-store --file C:/scripts/.git/.git-credentials get
09:33:23.174185 run-command.c:667       trace: run_command: 'git 
credential-manager-core store'
09:33:23.236463 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:23.236463 git.c:744               trace: exec: 
git-credential-manager-core store
09:33:23.236463 run-command.c:667       trace: run_command: 
git-credential-manager-core store
09:33:23.689909 run-command.c:667       trace: run_command: 'git 
credential-store --file C:/scripts/.git/.git-credentials store'
09:33:23.705534 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:23.705534 git.c:455               trace: built-in: git 
credential-store --file C:/scripts/.git/.git-credentials store
09:33:23.892547 run-command.c:667       trace: run_command: git rev-list 
--objects --stdin --not --all --quiet --alternate-refs
09:33:23.924306 run-command.c:667       trace: run_command: git rev-list 
--objects --stdin --not --all --quiet --alternate-refs
09:33:23.924306 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:23.924306 git.c:455               trace: built-in: git rev-list 
--objects --stdin --not --all --quiet --alternate-refs
09:33:23.939814 run-command.c:1628      run_processes_parallel: 
preparing to run up to 1 tasks
09:33:23.939814 run-command.c:1660      run_processes_parallel: done
09:33:23.939814 run-command.c:667       trace: run_command: git 
maintenance run --auto --no-quiet
09:33:23.939814 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:23.939814 git.c:455               trace: built-in: git maintenance 
run --auto --no-quiet
09:33:23.939814 run-command.c:667       trace: run_command: git merge 
FETCH_HEAD
09:33:23.955440 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
09:33:23.955440 git.c:455               trace: built-in: git merge 
FETCH_HEAD
Already up to date.

The same happens when i try this with the ssh connection, but the 
command hangs when trying to exec git-credential-manager-core get:

PS C:\scripts> git pull
10:02:33.240054 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/bin
10:02:33.240054 git.c:455               trace: built-in: git pull
10:02:33.240054 run-command.c:667       trace: run_command: git fetch 
--update-head-ok
10:02:33.255676 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
10:02:33.255676 git.c:455               trace: built-in: git fetch 
--update-head-ok
10:02:33.255676 run-command.c:667       trace: run_command: GIT_DIR=.git 
git remote-https origin 
https://imiadmgit.f4.htw-berlin.de/f4-imi-li/windows-scripts.git
10:02:33.255676 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
10:02:33.255676 git.c:744               trace: exec: git-remote-https 
origin https://imiadmgit.f4.htw-berlin.de/f4-imi-li/windows-scripts.git
10:02:33.255676 run-command.c:667       trace: run_command: 
git-remote-https origin 
https://imiadmgit.f4.htw-berlin.de/f4-imi-li/windows-scripts.git
10:02:33.271297 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
10:02:33.380647 run-command.c:667       trace: run_command: 'git 
credential-manager-core get'
10:02:33.396268 exec-cmd.c:237          trace: resolved executable dir: 
C:/Program Files/Git/mingw64/libexec/git-core
10:02:33.396268 git.c:744               trace: exec: 
git-credential-manager-core get
10:02:33.396268 run-command.c:667       trace: run_command: 
git-credential-manager-core get

Anyway as far as i understood git should not exec 
git-credential-manager-core get at all with my local git configuration?

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.32.0.windows.2
cpu: x86_64
built from commit: 3d45ac813c4adf97fe3733c1f763ab6617d5add5
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 19043
compiler info: gnuc: 10.3
libc info: no libc information available
$SHELL (typically, interactive shell): <unset>


[Enabled Hooks]

*****************************************************************************



-- 
Thanks, Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with credential.helper=store in git 2.32.0.windows.2
  2022-01-06 12:32 Problem with credential.helper=store in git 2.32.0.windows.2 Imi Admin
@ 2022-01-09 21:53 ` Johannes Schindelin
  2022-01-10  7:58   ` Sebastian Richter
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2022-01-09 21:53 UTC (permalink / raw)
  To: Imi Admin; +Cc: git

Hi Sebastian,

On Thu, 6 Jan 2022, Imi Admin wrote:

> Here's my local git configuration:
>
> PS C:\scripts> git config -l --show-origin
> [...]
> file:C:/Program Files/Git/etc/gitconfig	credential.helper=manager-core
> file:C:/Program Files/Git/etc/gitconfig	credential.https://dev.azure.com.usehttppath=true
> file:C:/Program Files/Git/etc/gitconfig	init.defaultbranch=master
> file:.git/config	core.repositoryformatversion=0
> file:.git/config	core.filemode=false
> file:.git/config	core.bare=false
> file:.git/config	core.logallrefupdates=true
> file:.git/config	core.symlinks=false
> file:.git/config	core.ignorecase=true
> file:.git/config	remote.origin.url=https://mygitlab.de/mygroup/myrepo.git
> file:.git/config	remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
> file:.git/config	branch.master.remote=origin
> file:.git/config	branch.master.merge=refs/heads/master
> file:.git/config	user.name=myname
> file:.git/config	user.email=my@email
> file:.git/config	credential.helper=store --file C:/scripts/.git/.git-credentials
>
> [...]
>
> Anyway as far as i understood git should not exec git-credential-manager-core
> get at all with my local git configuration?

You need one additional thing to make that happen. As per
https://git-scm.com/docs/git-config#Documentation/git-config.txt-credentialhelper:

	Note that multiple helpers may be defined. See gitcredentials[7]
	for details and examples.

And in https://git-scm.com/docs/gitcredentials#_configuration_options, we
read:

	If there are multiple instances of the credential.helper
	configuration variable, each helper will be tried in turn, and may
	provide a username, password, or nothing. Once Git has acquired
	both a username and a password, no more helpers will be tried.

	If credential.helper is configured to the empty string, this
	resets the helper list to empty (so you may override a helper set
	by a lower-priority config file by configuring the empty-string
	helper, followed by whatever set of helpers you would like).

So you need to insert a line "helper =` (with an empty value) in your
.git/config's `[credential]` section:

	[credential]
		# reset 'credential.helper' list
		helper =
		helper = "store --file C:/scripts/.git/.git-credentials"

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with credential.helper=store in git 2.32.0.windows.2
  2022-01-09 21:53 ` Johannes Schindelin
@ 2022-01-10  7:58   ` Sebastian Richter
  2022-01-10 12:52     ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Richter @ 2022-01-10  7:58 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Imi Admin, git

Hi Johannes,

thanks for clarifying this. I'm using 'git config --system --unset 
credential.helper' before setting the file store in the local 
configuration now and it works.

Best Sebastian

Am 09.01.2022 22:53, schrieb Johannes Schindelin:
> Hi Sebastian,
> 
> On Thu, 6 Jan 2022, Imi Admin wrote:
> 
>> Here's my local git configuration:
>> 
>> PS C:\scripts> git config -l --show-origin
>> [...]
>> file:C:/Program Files/Git/etc/gitconfig	credential.helper=manager-core
>> file:C:/Program 
>> Files/Git/etc/gitconfig	credential.https://dev.azure.com.usehttppath=true
>> file:C:/Program Files/Git/etc/gitconfig	init.defaultbranch=master
>> file:.git/config	core.repositoryformatversion=0
>> file:.git/config	core.filemode=false
>> file:.git/config	core.bare=false
>> file:.git/config	core.logallrefupdates=true
>> file:.git/config	core.symlinks=false
>> file:.git/config	core.ignorecase=true
>> file:.git/config	remote.origin.url=https://mygitlab.de/mygroup/myrepo.git
>> file:.git/config	remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
>> file:.git/config	branch.master.remote=origin
>> file:.git/config	branch.master.merge=refs/heads/master
>> file:.git/config	user.name=myname
>> file:.git/config	user.email=my@email
>> file:.git/config	credential.helper=store --file 
>> C:/scripts/.git/.git-credentials
>> 
>> [...]
>> 
>> Anyway as far as i understood git should not exec 
>> git-credential-manager-core
>> get at all with my local git configuration?
> 
> You need one additional thing to make that happen. As per
> https://git-scm.com/docs/git-config#Documentation/git-config.txt-credentialhelper:
> 
> 	Note that multiple helpers may be defined. See gitcredentials[7]
> 	for details and examples.
> 
> And in https://git-scm.com/docs/gitcredentials#_configuration_options, 
> we
> read:
> 
> 	If there are multiple instances of the credential.helper
> 	configuration variable, each helper will be tried in turn, and may
> 	provide a username, password, or nothing. Once Git has acquired
> 	both a username and a password, no more helpers will be tried.
> 
> 	If credential.helper is configured to the empty string, this
> 	resets the helper list to empty (so you may override a helper set
> 	by a lower-priority config file by configuring the empty-string
> 	helper, followed by whatever set of helpers you would like).
> 
> So you need to insert a line "helper =` (with an empty value) in your
> .git/config's `[credential]` section:
> 
> 	[credential]
> 		# reset 'credential.helper' list
> 		helper =
> 		helper = "store --file C:/scripts/.git/.git-credentials"
> 
> Ciao,
> Johannes

-- 
Hochschule für Technik und Wirtschaft
Wilhelminenhofstr. 75A
12459 Berlin
Gebäude C Raum 538
tel 030 5019 2945
fax 030 5019 48 2945
mail richter@htw-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with credential.helper=store in git 2.32.0.windows.2
  2022-01-10  7:58   ` Sebastian Richter
@ 2022-01-10 12:52     ` Johannes Schindelin
  2022-01-10 14:03       ` Sebastian Richter
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2022-01-10 12:52 UTC (permalink / raw)
  To: Sebastian Richter; +Cc: Imi Admin, git

Hi Sebastian,

On Mon, 10 Jan 2022, Sebastian Richter wrote:

> thanks for clarifying this. I'm using 'git config --system --unset
> credential.helper' before setting the file store in the local configuration
> now and it works.

I am not quite sure whether that is a good solution. You are changing the
system configuration for the benefit of a local configuration. That would
potentially break every other user outside of that repository that now
works.

My suggestion is to either go with my earlier recommendation and add an
empty `credential.helper` in the repository's config before the actual one
(and leave the system config alone), or alternatively change the system
config instead of the repository config in the first place.

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with credential.helper=store in git 2.32.0.windows.2
  2022-01-10 12:52     ` Johannes Schindelin
@ 2022-01-10 14:03       ` Sebastian Richter
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Richter @ 2022-01-10 14:03 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Imi Admin, git

Hi Johannes,

you are right, but during my (cluster) ssh connections no one else uses 
my systems (hopefully), and i do restore the system file afterwards.

But i'll implement your approach in the next script version.

Thanks & best Sebastian

Am 10.01.2022 13:52, schrieb Johannes Schindelin:
> Hi Sebastian,
> 
> On Mon, 10 Jan 2022, Sebastian Richter wrote:
> 
>> thanks for clarifying this. I'm using 'git config --system --unset
>> credential.helper' before setting the file store in the local 
>> configuration
>> now and it works.
> 
> I am not quite sure whether that is a good solution. You are changing 
> the
> system configuration for the benefit of a local configuration. That 
> would
> potentially break every other user outside of that repository that now
> works.
> 
> My suggestion is to either go with my earlier recommendation and add an
> empty `credential.helper` in the repository's config before the actual 
> one
> (and leave the system config alone), or alternatively change the system
> config instead of the repository config in the first place.
> 
> Ciao,
> Johannes

-- 
Hochschule für Technik und Wirtschaft
Wilhelminenhofstr. 75A
12459 Berlin
Gebäude C Raum 538
tel 030 5019 2945
fax 030 5019 48 2945
mail richter@htw-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-10 14:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 12:32 Problem with credential.helper=store in git 2.32.0.windows.2 Imi Admin
2022-01-09 21:53 ` Johannes Schindelin
2022-01-10  7:58   ` Sebastian Richter
2022-01-10 12:52     ` Johannes Schindelin
2022-01-10 14:03       ` Sebastian Richter

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).