Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35959

Gcmw and git-client-plugin collide

    Details

    • Similar Issues:

      Description

      The main issue appear to be a bad interaction between git-client-plugin and gcmw (Git Credential Manager For Windows):
      Gcmw works by using in the config "credential.helper=manager". This means than git will normally get the user and password Gcmw will provide.
      But with "core.askpass=true" stuff will not work as expected.The build will fail. Example:
      ...
      > git.exe --version # timeout=10
      > git.exe -c core.askpass=true fetch --tags --progress http://*************.git +refs/heads/:refs/remotes/origin/
      ERROR: Timeout after 10 minutes
      ERROR: Error fetching remote repo 'origin'
      .....
      What we need is something to deactivate core.askpass=true I think.

      Note: Even if there is or there isn't in the Repository Credentials a user defines the result is the same.
      Note: Gcmw is https://github.com/Microsoft/Git-Credential-Manager-for-Windows

        Attachments

          Issue Links

            Activity

            Hide
            markewaite Mark Waite added a comment - - edited

            The credentials for Jenkins jobs should be managed within the Jenkins environment. The git credentials manager for Windows is focused on improving the experience for an interactive user.

            The documentation of the credentials manager for windows includes instructions to disable prompting from the credentials manager with the environment variable GCM_INTERACTIVE=never.

            I've submitted a git client plugin pull request to set GCM_INTERACTIVE=never unless the Jenkins server has the property:

            org.jenkinsci.plugins.gitclient.CliGitAPIImpl.promptForAuthentication=true
            

            That property will prevent setting GCM_INTERACTIVE=never.

            Show
            markewaite Mark Waite added a comment - - edited The credentials for Jenkins jobs should be managed within the Jenkins environment. The git credentials manager for Windows is focused on improving the experience for an interactive user. The documentation of the credentials manager for windows includes instructions to disable prompting from the credentials manager with the environment variable GCM_INTERACTIVE=never. I've submitted a git client plugin pull request to set GCM_INTERACTIVE=never unless the Jenkins server has the property: org.jenkinsci.plugins.gitclient.CliGitAPIImpl.promptForAuthentication=true That property will prevent setting GCM_INTERACTIVE=never.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Mark Waite
            Path:
            src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
            http://jenkins-ci.org/commit/git-client-plugin/898861502128a1875f904172d89c7df21d4c6032
            Log:
            JENKINS-35959 Don't prompt interactively for credentials

            Use git 2.3+ GIT_TERMINAL_PROMPT=0 to prevent git auth prompt.
            Older git versions may continue to prompt for interactive credentials,
            since they don't recognize the GIT_TERMINAL_PROMPT variable.

            Command line git prompts for authentication if connected to a terminal.
            Jenkins agents running as a service are not connected to a terminal.
            Jenkins agents running from a desktop (Windows or interactive docker)
            may run a git process which prompts for authentication. This setting
            should reduce the ways that a newer command line git installation can
            block. Support for GIT_TERMINAL_PROMPT was first added in git 2.3.

            Don't prompt from Git Credentials Manager (Windows).

            Refer to
            https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/105a222711afd00166182b0d95776572a40f57af/Cli-Shared/Program.cs#L62

            User can return to old behavior with the CliGitAPIImpl property
            org.jenkinsci.plugins.gitclient.CliGitAPIImpl.promptForAuthentication=true

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java http://jenkins-ci.org/commit/git-client-plugin/898861502128a1875f904172d89c7df21d4c6032 Log: JENKINS-35959 Don't prompt interactively for credentials Use git 2.3+ GIT_TERMINAL_PROMPT=0 to prevent git auth prompt. Older git versions may continue to prompt for interactive credentials, since they don't recognize the GIT_TERMINAL_PROMPT variable. Command line git prompts for authentication if connected to a terminal. Jenkins agents running as a service are not connected to a terminal. Jenkins agents running from a desktop (Windows or interactive docker) may run a git process which prompts for authentication. This setting should reduce the ways that a newer command line git installation can block. Support for GIT_TERMINAL_PROMPT was first added in git 2.3. Don't prompt from Git Credentials Manager (Windows). Refer to https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/105a222711afd00166182b0d95776572a40f57af/Cli-Shared/Program.cs#L62 User can return to old behavior with the CliGitAPIImpl property org.jenkinsci.plugins.gitclient.CliGitAPIImpl.promptForAuthentication=true
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Mark Waite
            Path:
            src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
            src/test/java/org/jenkinsci/plugins/gitclient/CredentialsTest.java
            http://jenkins-ci.org/commit/git-client-plugin/ad9024d43d2d3c086a5bc677acbafe76dbb5b2c4
            Log:
            Merge pull request #278 from MarkEWaite/use-git-terminal-prompt-env

            JENKINS-35959 Don't prompt for credentials

            Compare: https://github.com/jenkinsci/git-client-plugin/compare/5c9f28d127aa...ad9024d43d2d

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java src/test/java/org/jenkinsci/plugins/gitclient/CredentialsTest.java http://jenkins-ci.org/commit/git-client-plugin/ad9024d43d2d3c086a5bc677acbafe76dbb5b2c4 Log: Merge pull request #278 from MarkEWaite/use-git-terminal-prompt-env JENKINS-35959 Don't prompt for credentials Compare: https://github.com/jenkinsci/git-client-plugin/compare/5c9f28d127aa...ad9024d43d2d
            Hide
            markewaite Mark Waite added a comment -

            Will be fixed with release of git client plugin 2.6.0

            Show
            markewaite Mark Waite added a comment - Will be fixed with release of git client plugin 2.6.0
            Hide
            markewaite Mark Waite added a comment -

            Included in git client plugin 2.6.0, released 27 Oct 2017

            Show
            markewaite Mark Waite added a comment - Included in git client plugin 2.6.0, released 27 Oct 2017
            Hide
            medianick Nick Jones added a comment -

            A related question was raised on StackOverflow and I answered it here: https://stackoverflow.com/questions/36479201/stuck-at-fetch-due-to-authentication-issue/37753202#37753202. In our case we simply unset credential.helper entirely on our Jenkins nodes; the main hassle there is that it must be redone every time we upgrade Git for Windows (via Chocolatey) since it resets credential.helper to manager.

            Show
            medianick Nick Jones added a comment - A related question was raised on StackOverflow and I answered it here: https://stackoverflow.com/questions/36479201/stuck-at-fetch-due-to-authentication-issue/37753202#37753202 . In our case we simply unset credential.helper entirely on our Jenkins nodes; the main hassle there is that it must be redone every time we upgrade Git for Windows (via Chocolatey) since it resets credential.helper to manager .

              People

              • Assignee:
                Unassigned
                Reporter:
                sava_n_dragos Dragos Sava
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: