Skip to content

Commit 1cb33f3

Browse files
[so-create-repo] do not fail user profile setup if SSH public key is already added to GitLab
1 parent 9e5a6bf commit 1cb33f3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

so-create-repo.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,13 @@ setup_user_profile()
175175
# get key ID
176176
id=$(echo $res | jq -r '.id')
177177
if [ "$id" == "null" ]; then
178-
echo -e "error: Adding SSH public key failed ... exiting\n"
179-
exit 1
178+
message=$(echo $res | jq -r '.message | .fingerprint | .[0]')
179+
if [ "$message" == "has already been taken" ]; then
180+
echo -e "Your SSH public key is already added to GitLab!\n"
181+
else
182+
echo -e "error: Adding SSH public key failed ... exiting\n"
183+
exit 1
184+
fi
180185
else
181186
echo -e "Your SSH public key was successfully added to GitLab!\n"
182187
fi

0 commit comments

Comments
 (0)