I’m writing an bash script that will add an SSH-key
to an in-house Gitlab server. Below is the code:
userToken=$(curl http://gitserver/api/v3/session --data 'login=*****&password=****' | jq '.private_token')
userToken=$(echo "$userToken" | tr -d '"')
# Below key is for testing, will use output of cat ~/.ssh/id_rsa.pub later on
sshKey="ssh-rsa AA*********L ****@***com"
curl --data "private_token=$userToken&title=keyName&key=$sshKey" "http://gitserver/api/v3/user/keys"
But I get this response:
{
"message": {
"fingerprint": [
"cannot be generated"
]
}
}
But when I mannualy insert the same key through the webbrowser, everything is just working fine…
So what am I doing wrong? Do I miss an option or is there somewhere an setting I’m unaware of?