You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This doesn't work for me. After investigating, here is what I tried:
I tried to output the key to check that it exists and was read right, this works
Then I tried to add a public key, using the same command, and here's where it gets weird: the public key never appears. I created a secret called ssh_key_pub, same way as I created my ssh_key secret.
And if I use cat to check the file, it is empty, whereas this worked for the private key.
So first question: Why would the exact same method work for one secret and not the other? Note that I added the secrets in the web UI, as I can't find any documentation for the drone secret command that actually works.
Then, I tried just pasting the public key in my pipeline, and then it worked, I could see both keys correctly in the right files using cat, but git still refuses to pull:
npm ERR! Permission denied (publickey).
23s
32
npm ERR! fatal: Could not read from remote repository.
23s
33
npm ERR!
23s
34
npm ERR! Please make sure you have the correct access rights
23s
35
npm ERR! and the repository exists.
23s
36
npm ERR!
23s
37
npm ERR! exited with error code: 128
So I have no idea how I am actually supposed to get drone to actually properly use a set of SSH keys, because whatever I do, it never works.
The text was updated successfully, but these errors were encountered:
Alternatively, you can use git+https instead of using ssh keys. Drone creates a netrc file with credentials that git will use to automatically authenticate http requests.
If you do not want to change your package.json file you can easily instruct git to globally override and replace git+ssh urls with git+https urls. You can use the below command as documented in this StackOverflow discussion.
I initially read this issue about supporting ssh keys (and added a comment on it).
The proposed solution is to add the ssh key to your secret keys, and then in your pipeline do so:
- mkdir /root/.ssh && echo "$SSH_KEY" > /root/.ssh/id_rsa && chomd 0600 /root/.ssh/id_rsa
This doesn't work for me. After investigating, here is what I tried:
I tried to output the key to check that it exists and was read right, this works
Then I tried to add a public key, using the same command, and here's where it gets weird: the public key never appears. I created a secret called
ssh_key_pub
, same way as I created myssh_key
secret.Then I did
And if I use
cat
to check the file, it is empty, whereas this worked for the private key.So first question: Why would the exact same method work for one secret and not the other? Note that I added the secrets in the web UI, as I can't find any documentation for the
drone secret
command that actually works.Then, I tried just pasting the public key in my pipeline, and then it worked, I could see both keys correctly in the right files using
cat
, but git still refuses to pull:So I have no idea how I am actually supposed to get drone to actually properly use a set of SSH keys, because whatever I do, it never works.
The text was updated successfully, but these errors were encountered: