How to execute git commands outside of the git connector


Customers may require the need to execute git commands (in particular: git lfs fetch) after a git repo is cloned by Harness in a pipeline.


This can be done using 2 options

First Option is to use a Run Step:

- step:

2 type: Run

3 name: git lfs pull

4 identifier: git_lfs_pull

5 spec:

6 connectorRef: account.Docker_Hub

7 image: alpine/git

8 shell: Sh

9 command: |-

10 mkdir -p ~/.ssh

11 cat << EOF > id_rsa

12 <+secrets.getValue("account.BitbucketGithubSSHKey")>

13 EOF

14 mv id_rsa ~/.ssh

15 chmod 600 ~/.ssh/id_rsa

16 ssh-keyscan -t rsa >> ~/.ssh/known_hosts

17 git config --global ""

18 git config --global "Automation User"


20 git lfs pull

Another option is a Drone plugin created by, one of our engineers.

Plugin name: mansong/git-plugin