Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing SSH key in build step

Gavin Thomas August 13, 2018

I've set up a SSH key within my pipelines settings and got the server admin to add the public key on the server. I've then added the known hosts to get a fingerprint.

 

Question is how do i reference this key in my build scripts? I usually use gulp to FTP files up to a remote server and i've found some gulp ssh packages.

 

Can i store this key as an environment variable as i have done for the FTP stuff?

2 answers

0 votes
Gavin Thomas August 15, 2018

I cracked this yesterday. Looks like i can't use gulp ssh as it can't access the filesystem remotely. not sure if this is true?

I used rsync directly in the bitbucket pipelines script

```- rsync -azvvP --omit-dir-times --no-perms ./build/ {username}@{host}:/{remotepath} ```

0 votes
Gavin Thomas August 13, 2018

For example in my build scripts it asks a reference to the ssh key

 

var config = {  host: '192.168.0.21',  port: 22,  username: 'node',  privateKey: fs.readFileSync('/Users/zensh/.ssh/id_rsa')} 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events