Answers: <p>Yes, full cloning of LFS files can be restricted!  By default, GitLab will clone your repo into the CI/CD build directory.  To limit the clone from downloading the LFS files, tell it not to do it.  You do this by setting a variable in <code>.gitlab-ci.yml</code> like this.</p>
  
  <pre><code># Other declarations etc above the specific job
  jobname:
    variables:
      GIT_LFS_SKIP_SMUDGE: 1
  # More job declarations, etc.
  </code></pre>
  
  <p>The "smudge" process replaces the link/pointers to the LFS files with the actual files.  By telling GitLab's CI job to skip the smudge, the LFS files aren't downloaded.</p>
  
  <p>Placing <code>GIT_LFS_SKIP_SMUDGE: 1</code> in a variables section at the top may make it apply to all of the defined jobs.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-06-18T14:31:50.233Z
Answers: 2019-06-18T14:31:50.233Z
Answers: rickhg12hs
Body: <p>When our GitLab CI/CD job runs, it first pulls a Docker image and then git clones the entire repo.  Afterwards, the Build commands are executed in the Docker image, etc.</p>
  
  <p>Is it possible to only clone the <strong>non</strong>-LFS files from the repo?  ... Or perhaps clone the HEAD of the master branch from only a specific subdirectory and it's subdirectories, etc.?</p>
  
Tags: <gitlab><gitlab-ci-runner><git-lfs>
Title: GitLab CI/CD job without pulling LFS files?
UserDisplayName: rickhg12hs
ThreadText: # GitLab CI/CD job without pulling LFS files?
  
  (Asked by: username_0 on 2019-06-12)
  
  When our GitLab CI/CD job runs, it first pulls a Docker image and then git clones the entire repo. Afterwards, the Build commands are executed in the Docker image, etc.
  
  Is it possible to only clone the **non**-LFS files from the repo? ... Or perhaps clone the HEAD of the master branch from only a specific subdirectory and it's subdirectories, etc.?
  
  **Tags:** gitlab, gitlab-ci-runner, git-lfs
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-06-18. Score: 5 | Accepted answer
  
  Yes, full cloning of LFS files can be restricted! By default, GitLab will clone your repo into the CI/CD build directory. To limit the clone from downloading the LFS files, tell it not to do it. You do this by setting a variable in `.gitlab-ci.yml` like this.
  
  ```
  # Other declarations etc above the specific job
  jobname:
    variables:
      GIT_LFS_SKIP_SMUDGE: 1
  # More job declarations, etc.
  
  ```
  
  The "smudge" process replaces the link/pointers to the LFS files with the actual files. By telling GitLab's CI job to skip the smudge, the LFS files aren't downloaded.
  
  Placing `GIT_LFS_SKIP_SMUDGE: 1` in a variables section at the top may make it apply to all of the defined jobs.
  
  
  ---
  
  