 <p>id_rsa.pub is base64 encoded file, it contains "+" character</p> <p>http post with application/x-www-form-urlencoded, need encode it's content preventing "+" being convert to " " (space key) </p> <p>try </p> <pre><code>curl --data-urlencode "key=$key_pub" --data-urlencode "title=$hostname" \ http://gitlabserver/api/v3/user/keys?private_token=$Token </code></pre> <p>see: <a href="http://stackoverflow.com/a/23152871/719995">this</a></p>