Clone private repository using freestyle step

Using this repository we’ll help you get up to speed with basic functionality such as: building Docker images and extend the git-clone step.

This project uses Node Js to build an application which will eventually become a distributable Docker image. If you want to extend the step git-clone you can use the freestyle step

Looking around

In the root of this repository you’ll find a file named codefresh.yml, this is our build descriptor and it describes the different steps that comprise our process. Let’s quickly review the contents of this file:

codefresh.yml

git_clone_private_repo:
      image: codefreshio/git-image:latest
      working_directory: ${{main_clone}}
      commands:
        - bash -c 'rm -rf /codefresh/volume/{repo_name}/'
        - git clone https://{username}:{password}@github.com/**/**.git /codefresh/volume/{repo_name}
        - bash -c 'cd /codefresh/volume/{repo_name}/ && git checkout {branch_name} && git branch && git status'
        - ls -l /codefresh/volume/{repo_name}

You can try the example bellow just replace the following variables

Variable Description
${{REPO_NAME}} Repository name
${{USERNAME}} Username from your private repository
${{PASSWORD}} Password from you private repository
${{BRANCH_NAME}} This branch name will be used for git checkout ${{BRANCH_NAME}}
Example

Just head over to the example repository in Github and follow the instructions there.