steps.checkout definition

Use checkout to configure how the pipeline checks out source code.

steps:
- checkout: string # Required as first property. Whether or not to check out the repository containing this pipeline definition.  (self, none)
  clean: string # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.  (true, false)
  fetchDepth: string # Depth of Git graph to fetch. 
  lfs: string # set to 'true' to download Git-LFS files. Default is not to download them.
  persistCredentials: string # set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
  submodules: true | recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
  condition: string # Evaluate this condition expression to determine whether to run this task. 
  continueOnError: boolean # Continue running even on failure?.  (false,n,no,off,on,true,y,yes)
  displayName: string # Human-readable name for the task. 
  enabled: boolean # Run this task when the job runs?.  (false,n,no,off,on,true,y,yes)
  env:  # Variables to map into the process's environment
    string: string # Name/value pairs.
  name: string # ID of the step.  ([-_A-Za-z0-9]*)
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it. 

Properties that use this definition: steps

Properties

checkout

string

Required as first parameter. Whether or not to check out the repository containing this pipeline definition. Acceptable values: self, none

clean

string

If true, run git clean -ffdx followed by git reset --hard HEAD before fetching. Acceptable values: true, false

fetchDepth

string

Depth of Git graph to fetch.

lfs

string

Set to 'true' to download Git-LFS files. Default is not to download them.

persistCredentials

string

Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.

submodules

string

Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.

condition

string

Evaluate this condition expression to determine whether to run this task.

continueOnError

boolean

Continue running even on failure?

displayName

string

Human-readable name for the task.

enabled

boolean

Run this task when the job runs?

env

string name/value pairs

Variables to map into the process's environment.

name

string

ID of the step. Acceptable values: [_A-Za-z0-9]*

timeoutInMinutes

string

Time to wait for this task to complete before the server kills it.

steps:
- checkout: string # Required as first property. Whether or not to check out the repository containing this pipeline definition.  (self, none)
  clean: string # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.  (true, false)
  fetchDepth: string # Depth of Git graph to fetch. 
  lfs: string # set to 'true' to download Git-LFS files. Default is not to download them.
  persistCredentials: string # set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
  submodules: true | recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
  path: string # Where to put the repository. The root directory is $(Pipeline.Workspace). 
  condition: string # Evaluate this condition expression to determine whether to run this task. 
  continueOnError: boolean # Continue running even on failure?.  (false,n,no,off,on,true,y,yes)
  displayName: string # Human-readable name for the task. 
  enabled: boolean # Run this task when the job runs?.  (false,n,no,off,on,true,y,yes)
  env:  # Variables to map into the process's environment
    string: string # Name/value pairs.
  name: string # ID of the step.  ([-_A-Za-z0-9]*)
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it. 

Properties that use this definition: steps

Properties

checkout

string

Required as first parameter. Whether or not to check out the repository containing this pipeline definition. Acceptable values: self, none

clean

string

If true, run git clean -ffdx followed by git reset --hard HEAD before fetching. Acceptable values: true, false

fetchDepth

string

Depth of Git graph to fetch.

lfs

string

Set to 'true' to download Git-LFS files. Default is not to download them.

persistCredentials

string

Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.

submodules

string

Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.

path

string

Where to put the repository. The root directory is $(Pipeline.Workspace).

condition

string

Evaluate this condition expression to determine whether to run this task.

continueOnError

boolean

Continue running even on failure?

displayName

string

Human-readable name for the task.

enabled

boolean

Run this task when the job runs?

env

string name/value pairs

Variables to map into the process's environment.

name

string

ID of the step. Acceptable values: [_A-Za-z0-9]*

timeoutInMinutes

string

Time to wait for this task to complete before the server kills it.

steps:
- checkout: string # Required as first property. Alias of the repository resource to check out or 'none'. 
  clean: string # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.  (true, false)
  fetchDepth: string # Depth of Git graph to fetch. 
  lfs: string # set to 'true' to download Git-LFS files. Default is not to download them.
  persistCredentials: string # set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
  submodules: true | recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
  path: string # Where to put the repository. The root directory is $(Pipeline.Workspace). 
  condition: string # Evaluate this condition expression to determine whether to run this task. 
  continueOnError: boolean # Continue running even on failure?.  (false,n,no,off,on,true,y,yes)
  displayName: string # Human-readable name for the task. 
  target: stepTarget # Environment in which to run this task
  enabled: boolean # Run this task when the job runs?.  (false,n,no,off,on,true,y,yes)
  env:  # Variables to map into the process's environment
    string: string # Name/value pairs.
  name: string # ID of the step.  ([-_A-Za-z0-9]*)
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it. 

Properties that use this definition: steps

Properties

checkout

string

Required as first parameter. Alias of the repository resource to check out or 'none'.

clean

string

If true, run git clean -ffdx followed by git reset --hard HEAD before fetching. Acceptable values: true, false

fetchDepth

string

Depth of Git graph to fetch.

lfs

string

Set to 'true' to download Git-LFS files. Default is not to download them.

persistCredentials

string

Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.

submodules

string

Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.

path

string

Where to put the repository. The root directory is $(Pipeline.Workspace).

condition

string

Evaluate this condition expression to determine whether to run this task.

continueOnError

boolean

Continue running even on failure?

displayName

string

Human-readable name for the task.

target

target

Environment in which to run this task.

enabled

boolean

Run this task when the job runs?

env

string name/value pairs

Variables to map into the process's environment.

name

string

ID of the step. Acceptable values: [_A-Za-z0-9]*

timeoutInMinutes

string

Time to wait for this task to complete before the server kills it.

steps:
- checkout: string # Required as first property. Alias of the repository resource to check out or 'none'. 
  clean: string # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.  (true, false)
  fetchDepth: string # Depth of Git graph to fetch. 
  lfs: string # set to 'true' to download Git-LFS files. Default is not to download them.
  persistCredentials: string # set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
  submodules: true | recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
  path: string # Where to put the repository. The root directory is $(Pipeline.Workspace). 
  condition: string # Evaluate this condition expression to determine whether to run this task. 
  continueOnError: boolean # Continue running even on failure?.  (false,n,no,off,on,true,y,yes)
  displayName: string # Human-readable name for the task. 
  target: stepTarget # Environment in which to run this task
  enabled: boolean # Run this task when the job runs?.  (false,n,no,off,on,true,y,yes)
  env:  # Variables to map into the process's environment
    string: string # Name/value pairs.
  name: string # ID of the step.  ([-_A-Za-z0-9]*)
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it. 

Properties that use this definition: steps

Properties

checkout

string

Required as first parameter. Alias of the repository resource to check out or 'none'.

clean

string

If true, run git clean -ffdx followed by git reset --hard HEAD before fetching. Acceptable values: true, false

fetchDepth

string

Depth of Git graph to fetch.

lfs

string

Set to 'true' to download Git-LFS files. Default is not to download them.

persistCredentials

string

Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.

submodules

string

Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.

path

string

Where to put the repository. The root directory is $(Pipeline.Workspace).

condition

string

Evaluate this condition expression to determine whether to run this task.

continueOnError

boolean

Continue running even on failure?

displayName

string

Human-readable name for the task.

target

target

Environment in which to run this task.

enabled

boolean

Run this task when the job runs?

env

string name/value pairs

Variables to map into the process's environment.

name

string

ID of the step. Acceptable values: [_A-Za-z0-9]*

timeoutInMinutes

string

Time to wait for this task to complete before the server kills it.

steps:
- checkout: string # Required as first property. Alias of the repository resource to check out or 'none'. 
  clean: string # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.  (true, false)
  fetchDepth: string # Depth of Git graph to fetch. 
  lfs: string # set to 'true' to download Git-LFS files. Default is not to download them.
  persistCredentials: string # set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
  submodules: true | recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
  path: string # Where to put the repository. The root directory is $(Pipeline.Workspace). 
  condition: string # Evaluate this condition expression to determine whether to run this task. 
  continueOnError: boolean # Continue running even on failure?.  (false,n,no,off,on,true,y,yes)
  displayName: string # Human-readable name for the task. 
  target: stepTarget # Environment in which to run this task
  enabled: boolean # Run this task when the job runs?.  (false,n,no,off,on,true,y,yes)
  env:  # Variables to map into the process's environment
    string: string # Name/value pairs.
  name: string # ID of the step.  ([-_A-Za-z0-9]*)
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it. 
  retryCountOnTaskFailure: string # Number of retries if the task fails. 

Properties that use this definition: steps

Properties

checkout

string

Required as first parameter. Alias of the repository resource to check out or 'none'.

clean

string

If true, run git clean -ffdx followed by git reset --hard HEAD before fetching. Acceptable values: true, false

fetchDepth

string

Depth of Git graph to fetch.

lfs

string

Set to 'true' to download Git-LFS files. Default is not to download them.

persistCredentials

string

Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.

submodules

string

Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.

path

string

Where to put the repository. The root directory is $(Pipeline.Workspace).

condition

string

Evaluate this condition expression to determine whether to run this task.

continueOnError

boolean

Continue running even on failure?

displayName

string

Human-readable name for the task.

target

target

Environment in which to run this task.

enabled

boolean

Run this task when the job runs?

env

string name/value pairs

Variables to map into the process's environment.

name

string

ID of the step. Acceptable values: [-_A-Za-z0-9]*

timeoutInMinutes

string

Time to wait for this task to complete before the server kills it.

retryCountOnTaskFailure

string

Number of retries if the task fails.

steps:
- checkout: string # Required as first property. Alias of the repository resource to check out or 'none'. 
  clean: string # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.  (true, false)
  fetchDepth: string # Depth of Git graph to fetch. 
  lfs: string # set to 'true' to download Git-LFS files. Default is not to download them.
  persistCredentials: string # set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
  submodules: true | recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
  path: string # Where to put the repository. The root directory is $(Pipeline.Workspace). 
  condition: string # Evaluate this condition expression to determine whether to run this task. 
  continueOnError: boolean # Continue running even on failure?.  (false,n,no,off,on,true,y,yes)
  displayName: string # Human-readable name for the task. 
  target: stepTarget # Environment in which to run this task
  enabled: boolean # Run this task when the job runs?.  (false,n,no,off,on,true,y,yes)
  env:  # Variables to map into the process's environment
    string: string # Name/value pairs.
  name: string # ID of the step.  ([-_A-Za-z0-9]*)
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it. 
  retryCountOnTaskFailure: string # Number of retries if the task fails. 

Properties that use this definition: steps

Properties

checkout

string

Required as first parameter. Alias of the repository resource to check out or 'none'.

clean

string

If true, run git clean -ffdx followed by git reset --hard HEAD before fetching. Acceptable values: true, false

fetchDepth

string

Depth of Git graph to fetch.

lfs

string

Set to 'true' to download Git-LFS files. Default is not to download them.

persistCredentials

string

Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.

submodules

string

Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.

path

string

Where to put the repository. The root directory is $(Pipeline.Workspace).

condition

string

Evaluate this condition expression to determine whether to run this task.

continueOnError

boolean

Continue running even on failure?

displayName

string

Human-readable name for the task.

target

target

Environment in which to run this task.

enabled

boolean

Run this task when the job runs?

env

string name/value pairs

Variables to map into the process's environment.

name

string

ID of the step. Acceptable values: [-_A-Za-z0-9]*

timeoutInMinutes

string

Time to wait for this task to complete before the server kills it.

retryCountOnTaskFailure

string

Number of retries if the task fails.

Remarks

The default value if the clean property is unset is configured by the clean setting in the UI settings for YAML pipelines, which is set to false by default. In addition to the cleaning option available using checkout, you can also configure cleaning in a workspace. For more information about workspaces and clean options, see the workspace topic in Jobs.

Examples

To avoid syncing sources at all:

steps:
- checkout: none

Note

If you're running the agent in the Local Service account and want to modify the current repository by using git operations or loading git submodules, give the proper permissions to the Project Collection Build Service Accounts user.

- checkout: self
  submodules: true
  persistCredentials: true

To check out multiple repositories in your pipeline, use multiple checkout steps:

- checkout: self
- checkout: git://MyProject/MyRepo
- checkout: MyGitHubRepo # Repo declared in a repository resource

For more information, see Check out multiple repositories in your pipeline.

See also