I want to add an ssh-key generated in a shell script to my gcp project metadata. The problem is, that I don't really know how to format the generated key to be in the format which is need for the project metadata. The ssh-key I have looks like this:
ssh-rsa AAAAB3.... username
The format that is stated in the documentation is this:
username:ssh-rsa AAAAB3....
Is there a way to reformat the key within my shell script using echo and cat?
My best try is this: echo $USERNAME:$(cat ~/.ssh/id_rsa.pub)
, but this still leaves the trailing username at the end.