jenkinsci / jenkinsci/git-plugin

[JENKINS-47733] Add a withGit pipeline step that provides git credentials

Open
#3,220 14 comments 0 reactions 0 assignees View on GitHub
component:git-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

It would be nice if we had a withGit step that would pre-configure the git credentials from the current "scm" object and allows us to invoke git from the command line as follows:

withGit {

sh 'git fetch'
}

The step would rely on the same GIT_ASKPASS mechanism as used during a "standard" checkout.

 

---
Originally reported by brenuart, imported from: Add a withGit pipeline step that provides git credentials


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 9
  • watchers: 13
  • imported: 2025-12-02

Raw content of original issue

It would be nice if we had a withGit step that would pre-configure the git credentials from the current "scm" object and allows us to invoke git from the command line as follows:



withGit {

sh 'git fetch'
}


The step would rely on the same GIT_ASKPASS mechanism as used during a "standard" checkout.

 

4 attachments

- [mktemp.groovy](https://issues.jenkins.io/secure/attachment/43509/mktemp.groovy)
- [rmdir.groovy](https://issues.jenkins.io/secure/attachment/43511/rmdir.groovy)
- [utils.groovy](https://issues.jenkins.io/secure/attachment/43510/utils.groovy)
- [withGit.groovy](https://issues.jenkins.io/secure/attachment/43504/withGit.groovy)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.