Set up a Git global configuration for use in CloudBees workflows.
The configure-git-global-credentials action authenticates the current user, scoped by default to repositories in the same organization as the workflow repository.
After this step runs, all steps using the Git CLI in the same job authenticate with these credentials.
Use this action to avoid failures caused by missing pre-authentication of private repositories.
For example, if building a Go module that depends on other private modules, private repository authentication must be in place for go mod download to run successfully.
|
|
This action may set up authentication for different types of Git global configurations, including:
CloudBees recommends ensuring that any Git client other than the official Git CLI supports the authentication configuration applied by this action. |
Configure access to specific repositories
Use this method to onboard specific repositories by creating an integration in CloudBees Unify.
The following example configures access to multiple repositories using a line-break-separated list:
- name: Git global credentials uses: cloudbees-io/configure-git-global-credentials@v2 with: repositories: | https://github.com/user1/repo https://github.com/user2/rep1
To configure access for all repositories within a GitHub project or user namespace, specify the project URL:
- name: Git global credentials uses: cloudbees-io/configure-git-global-credentials@v2 with: repositories: https://github.com/org/
To grant access to all accessible repositories on a host, specify a host URL. Access is determined by the SCM integration and credentials configured in CloudBees Unify for the component and its parent organizations:
- name: Git global credentials uses: cloudbees-io/configure-git-global-credentials@v2 with: repositories: https://github.beescloud.com/
Configure access for Bitbucket repositories using a workspace access token
If you have a Bitbucket Workspace access token configured in your SCM integration, grant access to all repositories in a workspace by specifying the workspace URL:
- name: Git global credentials uses: cloudbees-io/configure-git-global-credentials@v2 with: repositories: https://bitbucket.org/my-workspace/
Alternatively, specify individual Bitbucket repositories:
- name: Git global credentials uses: cloudbees-io/configure-git-global-credentials@v2 with: repositories: | https://bitbucket.org/my-workspace/repo-one https://bitbucket.org/my-workspace/repo-two
For more information about Bitbucket token types and required scopes, refer to Bitbucket access tokens reference.
Configure access using SSH
Add the SSH key as a secret property in CloudBees Unify and use the SSH clone URL in the repositories input.
| When defining the SSH key secret, ensure the secret value ends with a new line. |
- name: Git global credentials uses: cloudbees-io/configure-git-global-credentials@v2 with: repositories: "ssh://github.com/user/repo" ssh-key: ${{secrets.<ssh-secret-name-placeholder>}}
Inputs
| Input name | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
Repository clone URL, for example For multiple repositories, CloudBees recommends using a line-break separator, although the parameter also accepts a whitespace- or comma-separated list. |
|
String |
No |
SSH key used to fetch the repository.
Only relevant when an SSH clone URL is provided in the |
|
String |
No |
A list of known SSH hosts to add to the global host database.
Use the The public keys for GitHub and Bitbucket are added by default. |
|
Boolean |
No |
Default is |