20 lines
711 B
Bash
20 lines
711 B
Bash
|
|
GITLAB_URL="git.devuan.org"
|
|
GITLAB_USER="cyteen"
|
|
|
|
PRIVATE_TOKEN="P8mHeR6ASfAsHeqQKdvg" # https://git.devuan.org/profile/personal_access_tokens //*[@id="feed_token"]
|
|
RSA_KEY=$(cat ${HOME}/.ssh/id_rsa.pub)
|
|
|
|
# Send
|
|
echo "Sending key."
|
|
curl -d '{"title":"test key","key":"'"${RSA_KEY}"'"}' -H 'Content-Type: application/json' https://${GITLAB_URL}/api/v4/user/keys?private_token=${PRIVATE_TOKEN}
|
|
|
|
# {"id":3889765,"title":"test key","key":"ssh-rsa <my_ssh_key>","created_at":"2019-08-01T21:26:40.952Z"}
|
|
|
|
|
|
# Test
|
|
echo "Testing key."
|
|
curl https://${GITLAB_URL}/api/v4/user/keys?private_token=${PRIVATE_TOKEN}
|
|
|
|
# [{"id":3889765,"title":"test key","key":"ssh-rsa <my_ssh_key>","created_at":"2019-08-01T21:26:40.952Z"}]
|