[Question] "Adding read/write deployment key" for 2.0


#1

Hello,

Here is a question about deployment key.
Does this below instruction for 1.0 also works for 2.0?

https://circleci.com/docs/1.0/adding-read-write-deployment-key/

  • Create a ssh key pair by following the GitHub instructions Note: when asked “Enter passphrase (empty for no passphrase)”, do not enter a passphrase.
  • Go to https://github.com/you/test-repo/settings/keys on GitHub and click Add deploy key. Enter any title in the Title field, then copy and paste the public key you just created. Make sure to check Allow write access, then click Add key.
  • Go to https://circleci.com/gh/you/test-repo/edit#ssh on CircleCI and add the private key that you just created. Enter github.com in the Hostname field and press the submit button.

I have followed the instruction and tried out to git tags $TAG && git push --tags but it failed: https://circleci.com/gh/kenju/docker-elasticsearch-circleci/39

And if I delete the auto-generated deploy key for checking-out ( https://circleci.com/gh/#{user}/#{repo}/edit#checkout ), the primary container seems read private key and wait for “Enter passphrase” like this:

https://circleci.com/gh/kenju/docker-elasticsearch-circleci/38

Enter passphrase for key '/root/.ssh/id_rsa': 

How to reproduce

1 Follow below instruction and set ssh key pairs in CircleCI and GitHub

https://circleci.com/docs/1.0/adding-read-write-deployment-key/

2 Use the created ssh_key in Circle CI 2.0 config ( .circleci/config.yml )


#2

It looks like you got it working. What did you change?


#3

I removed git tag from config.yml, and currently do not use deployment key. That is why the latest build succeeded.


#4

Can you try starting the SSH agent?

https://circleci.com/docs/2.0/configuration-reference/#addsshkeys


#5

https://circleci.com/docs/2.0/configuration-reference/#addsshkeys

That was what I have missed.
Simply added

- add_ssh_keys

to config.yml and it solved. Thank you very much.


#6