title: Gitlab API add SSH-key
body: <p>I've problems adding an SSH key to my gitlab server trough the API (It works well trough the webpage).</p>
  <p>Gitlab information:
  <a href="https://i.stack.imgur.com/pYaVD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pYaVD.png" alt="Gitlab Information" /></a></p>
  <p>I came across <a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/1289" rel="nofollow noreferrer">this issue</a> (<a href="https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/519/diffs" rel="nofollow noreferrer">which was fixed here</a>)  which was related to an &quot;wrong&quot; openssh implementation. They've fixed this in milestone 7.10. Only thing... My server has openssh 6.6 installed:</p>
  <pre><code>OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3, OpenSSL 1.0.1f 6 Jan 2014
  </code></pre>
  <p>Now, I don't know if that fix is backwards compatible or not, but maybe good to mention.</p>
  <p>Also, the logs show no warning or errors or whatsoever. The /tmp/gitlab_key* files are generated on the server:
  <a href="https://i.stack.imgur.com/lOyiG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lOyiG.png" alt="output of /tmp/gitlab_key*" /></a></p>
  <p>The problem I'm facing is that gitlab <strong>can't create the fingerprint</strong> trough the API. This is the responce I get from the API:</p>
  <pre><code>{
      &quot;message&quot;: {
          &quot;fingerprint&quot;: [&quot;cannot be generated&quot;]
      }
  }
  </code></pre>
  <p>So right now I have no idea what the problem could be. I've been struggling with this for almost a week now, so I really hope that his problem could be fixed.</p>
  <p>-just for the record, here's the script I'm using to add the ssh-key trough the API</p>
  <pre class="lang-sh prettyprint-override"><code>#!/bin/bash
   
  jsonFile=&quot;jsonResponce&quot;
   
  echo `curl http://gitserver/api/v3/session --data 'login=****&amp;password=****'` &gt; $jsonFile
  userToken=$(jq '.private_token' $jsonFile)
   
  finalUserToken=$(echo &quot;$userToken&quot; | tr -d '&quot;')
   
  echo &quot;user token: $finalUserToken&quot;
   
  # Below key is for testing, will use output of cat ~/.ssh/id_rsa.pub later on
  # sshKey=&quot;ssh-rsa AAAAB3N***** ****@***.com
   
  # curl --data &quot;private_token=$userToken&amp;title=keyName&amp;key=$sshKey&quot; &quot;http://gitserver/api/v3/user/keys&quot;
   
  rm $jsonFile
  </code></pre>