Core Concepts
...
Pipelines
Steps
Git Clone
5min
clone a git repository into pipeline runtime environment git account and repository should be provided while creating a pipeline the account and the repository will be automatically used in the git clone step while executing the pipeline git clone step uses git accounts connected within microtica portal to obtain temporary access credentials git credentials credentials for the specified git repository will be automatically provided by microtica syntax microtica yaml steps step name type git clone clone dir sub/folder/ parameter description required title the display name of the step no type the type of the microtica built in step should always be git clone for this type of step yes clone dir path to where the source code should be cloned default current working dir of the pipeline runtime environment no ssh key provide a private ssh key to be used when cloning the source code from git repository the key should be provided in base64 format you can encode the private key in base64 format using the following command where id rsa is your private key cat / ssh/id rsa | base64 default null no clone submodules clone all submodules recursively for a given git repository default false no clone into sub directory by default the source code will be cloned in the current working dir of the pipeline runtime environment if you need to store the code in a different directory you can achieve that by using clone dir parameter microtica yaml steps clone type git clone clone dir sub/folder listcontent image alpine\ latest commands \ cd sub/folder \ ls l so, if you navigate to sub/folder and run ls l command in the next step you should be able to see the content of the source code root dir use an ssh key with git if you prefer to use an ssh key to access the git repository you can achieve this by providing your ssh key as pipeline sensitive environment variable with key ssh key to encode the private key in base64 format use the following command where id rsa is your private key cat / ssh/id rsa | base64 copy and paste the encoded key into pipeline variable you can find the environment varibales in resource/app settings under git security consideration please make sure that you enable sensitive option for the ssh key environment variable this way the value will be stored and processed in a secure storage instead of plain value if you want to use a different environment variable key then ssh key you can do that by using a step parameter and reference the pipeline environment variable below is an example step specification microtica yaml steps clone type git clone ssh key "{{my ssh key env var}}" where my ssh key env var is the environment variable key defined in the microtica pipeline