|
1 | 1 | <div> |
2 | 2 | <p> |
3 | | - Git step. It performs a clone from the specified repository. |
| 3 | + The <code>git</code> step performs a clone from the specified repository into a Pipeline workspace. |
4 | 4 | </p> |
5 | 5 | <p> |
6 | 6 | Use the <a href="https://www.jenkins.io/redirect/pipeline-snippet-generator">Pipeline Syntax Snippet Generator</a> to generate a sample pipeline script for the git step. |
7 | | - More advanced checkout operations require the <code>checkout</code> step rather than the <code>git</code> step. |
| 7 | + More advanced checkout operations require the <a href="https://www.jenkins.io/doc/pipeline/steps/params/scmgit/"><code>checkout</code> step</a> rather than the <code>git</code> step. |
8 | 8 | Examples of the <code>git</code> step include: |
9 | 9 | <ul> |
10 | 10 | <li><a href="#git-step-with-defaults">Git step with defaults</a></li> |
|
17 | 17 | </p> |
18 | 18 |
|
19 | 19 | <p> |
20 | | - The <code>git</code> step is a simplified shorthand for a subset of the more powerful <code>checkout</code> step: |
| 20 | + The <code>git</code> step is a simplified shorthand for a subset of the more powerful <a href="https://www.jenkins.io/doc/pipeline/steps/params/scmgit/"><code>checkout</code> step</a>: |
21 | 21 | <pre> |
22 | 22 | checkout scmGit(branches: [[name: 'main']], |
23 | 23 | userRemoteConfigs: [[url: 'https://git-server/user/repository.git']]) |
|
27 | 27 | <hr> |
28 | 28 |
|
29 | 29 | <p> |
30 | | - <strong>NOTE:</strong> The <code>checkout</code> step is the <strong>preferred SCM checkout method</strong>. |
| 30 | + <strong>NOTE:</strong> The <a href="https://www.jenkins.io/doc/pipeline/steps/params/scmgit/"><code>checkout</code> step</a> is the <strong>preferred SCM checkout method</strong>. |
31 | 31 | It provides significantly more functionality than the <code>git</code> step. |
32 | 32 | </p> |
33 | 33 | <p>Use the <a href="https://www.jenkins.io/redirect/pipeline-snippet-generator">Pipeline Syntax Snippet Generator</a> to generate a sample pipeline script for the checkout step. |
34 | 34 | </p> |
35 | 35 | <p> |
36 | | - The <code>checkout</code> step can be used in many cases where the <code>git</code> step cannot be used. |
37 | | - Refer to the <a href="https://plugins.jenkins.io/git/#plugin-content-extensions">git plugin documentation</a> for detailed descriptions of options available to the checkout step. |
| 36 | + The <a href="https://www.jenkins.io/doc/pipeline/steps/params/scmgit/"><code>checkout</code> step</a> can be used in many cases where the <code>git</code> step cannot be used. |
| 37 | + Refer to the <a href="https://plugins.jenkins.io/git/#plugin-content-extensions">git plugin documentation</a> for detailed descriptions of options available to the <a href="https://www.jenkins.io/doc/pipeline/steps/params/scmgit/"><code>checkout</code> step</a>. |
38 | 38 | For example, the <code>git</code> step does <strong>not</strong> support: |
39 | 39 | <ul> |
40 | 40 | <li>SHA-1 checkout</li> |
|
59 | 59 | Checkout from the git plugin source repository using https protocol, no credentials, and the master branch. |
60 | 60 | </p><p>The <a href="https://www.jenkins.io/redirect/pipeline-snippet-generator">Pipeline Syntax Snippet Generator</a> generates this example: |
61 | 61 | <pre> |
62 | | -git 'https://github.com/jenkinsci/git-plugin' |
| 62 | +git 'https://github.com/jenkinsci/git-plugin.git' |
63 | 63 | </pre> |
64 | 64 | </p> |
65 | 65 |
|
66 | 66 | <strong><a id="git-step-with-https-and-branch">Example: Git step with https and a specific branch</a></strong> |
67 | 67 | <p> |
68 | | - Checkout from the Jenkins source repository using https protocol, no credentials, and a specific branch (stable-2.204). |
| 68 | + Checkout from the Jenkins source repository using https protocol, no credentials, and a specific branch (stable-2.492). |
69 | 69 | Note that this must be a local branch name like 'master' or 'develop'. |
70 | 70 | </p> |
71 | 71 | <p> |
|
76 | 76 | <li>Tag names are <strong>not supported</strong> as the branch argument</li> |
77 | 77 | </ul> |
78 | 78 | <p> |
79 | | - Remote branch names, SHA-1 hashes, and tag names <strong>are supported</strong> by the general purpose <code>checkout</code> step. |
| 79 | + Remote branch names, SHA-1 hashes, and tag names <strong>are supported</strong> by the general purpose <a href="https://www.jenkins.io/doc/pipeline/steps/params/scmgit/"><code>checkout</code> step</a>. |
80 | 80 | </p> |
81 | 81 | <p>The <a href="https://www.jenkins.io/redirect/pipeline-snippet-generator">Pipeline Syntax Snippet Generator</a> generates this example: |
82 | 82 | <pre> |
83 | | -git branch: 'stable-2.204', |
| 83 | +git branch: 'stable-2.492', |
84 | 84 | url: 'https://github.com/jenkinsci/jenkins.git' |
85 | 85 | </pre> |
86 | 86 | </p> |
|
0 commit comments