Get gitlab-ci token with gitlab API
<p>It's unclear from the API how to get the token that can be used to clone http repositories.</p>

<p>From the documentation here: </p>

<p><a href="http://doc.gitlab.com/ee/ci/api/README.html" rel="noreferrer">http://doc.gitlab.com/ee/ci/api/README.html</a></p>

<p>It should be possible to GET this url:</p>

<pre><code>http://gitlab.com/ci/api/v1/projects?private_token=QVy1PB7sTxfy4pqfZM1U&amp;url=http://demo.gitlab.com/
</code></pre>

<p>I'm not sure where the <code>url</code> parameter is taken from but even with just my private token, it receive a 404 error page.</p>

<p>I tried with the <code>ci</code> subdomain but it simply redirect me to gitlab.com.</p>

<p>That said, I'll explain a bit more the reason why I need that. I have a server that could have multiple projects. Each projects will contain a list of repositories private/public each project has to be cloned/pulled and whatever regularly. Unlike github, gitlab doesn't provide a oauth2 token that is sitewide and instead provide a CI-token for each project. I could make sure that the user enter the token for each project but that is way more complicated than entering the private token.</p>

<p>On the other hand, I could generate SSH keys for each users and add the public key to their account and this way it would be possible to fetch/clone with ssh instead of http. But that is a bit more work on my end than just fetching a token and cloning with a basic auth url</p>

<pre><code>git clone https://gitlab-ci-token:token@gitlab.com/project.git
</code></pre>