title: Using bash command to download all gitlab projects at once
body: <p>I have more than 200 projects in my gitlab account. I want to download them all. I am using below command.</p>
  
  <pre><code>TOKEN="XXXXXXXXXX";
  PREFIX="ssh_url_to_repo";
  curl --header "PRIVATE-TOKEN: $TOKEN" http://vrath.gitlabtest.com/api/v4/projects?per_page=100 |
      grep -o "\"$PREFIX\":[^ ,]\+" |
      awk -F ':' '{printf "ssh://"; for (i=2; i&lt;NF; i++) printf $i "/"; print $NF}' |
      xargs -L1 git clone
  </code></pre>
  
  <p>Above command is working fine but it only downloads 100 projects. I tried to do pagination but it is not working.</p>
  
  <pre><code>TOKEN="XXXXXXXXXX";
  PREFIX="ssh_url_to_repo";
  curl --header "PRIVATE-TOKEN: $TOKEN" http://vrath.gitlabtest.com/api/v4/projects?per_page=100&amp;page=2 |
      grep -o "\"$PREFIX\":[^ ,]\+" |
      awk -F ':' '{printf "ssh://"; for (i=2; i&lt;NF; i++) printf $i "/"; print $NF}' |
      xargs -L1 git clone
  </code></pre>
  
  <ol>
  <li>Can someone help me how to fix this? Is there any better way?</li>
  <li>If you see this command: <code>grep -o "\"$PREFIX\":[^ ,]\+" | awk -F ':' '{printf "ssh://"; for (i=2; i&lt;NF; i++) printf $i "/"; print $NF}'</code></li>
  </ol>
  
  <p>It will list down all the projects from "vrath.gitlabtest.com" but I can add some filers here? where it will list down project only for "vrath.gitlabtest/app1" or "vrath.gitlabtest/app2"</p>