Git strategy

Hello Everyone,
I’m planning to do something like this,
Clone a git repo if it does not exist, or pull into it if it does exist

  • if local repo not there yet: clone
  • if it’s there: pull

I know I could script this around (e.g if [ -d repo ]; then (cd repo && git pull); else git clone $repourl;fi

But as I observed - there is a way to do.
How can I use GIT_STRATEGY ?
If yes, could you please provide me an example, it would be great appreciate.
Thanks in advance.

Here is my .yaml file.

  - test
  - build
  - deploy

  stage: test
  script: echo "Running tests, place need to write test cases"
  stage: build
  script: echo "Building the app"

# install ssh-agent
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# run ssh-agent
- eval $(ssh-agent -s)
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
# WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

  stage: deploy
  # try to connect to GitLab
  - ssh -T git@10.0.0.****
  # Change the directory to webstation directory
  - cd /usr/share/nginx/html/webstation
  # Create folder with the name as current branch, if it not exists
  - mkdir -p sprint-8
  # Gave read and write permissions
  - chmod 755 sprint-8
  # Change the directory to current branch
  - cd sprint-8
  # try to clone yourself, the SSH_PRIVATE_KEY was added as deploy key to this repository
  - git clone -b sprint-8 git@10.0.0.***:osmosys/webstation-portal-v2.git .
  # To know the status and branch
  - git status
  - git branch
  # Setup basic installations 
  - npm install 
  - grunt prod
  # command to run 
    name: staging
    url: http://10.0.0.***
  - sprint-8