Skip to content

Instantly share code, notes, and snippets.

@kelvinc1024
Last active February 18, 2019 01:58
Show Gist options
  • Save kelvinc1024/7782edac3df63e9d4f4236213fc70696 to your computer and use it in GitHub Desktop.
Save kelvinc1024/7782edac3df63e9d4f4236213fc70696 to your computer and use it in GitHub Desktop.
sh("mkdir ~/.ssh")
withCredentials([sshUserPrivateKey(credentialsId: '1234-abcd-efgh-5678', keyFileVariable: 'SSH_PRIVATE_KEY', passphraseVariable: 'SSH_PASS', usernameVariable: 'SSH_USER')]) {
sh("cp $SSH_PRIVATE_KEY ~/.ssh/id_rsa")
}
sh("chmod 700 ~/.ssh/id_rsa")
sh 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=~/.ssh/known_hosts -p 7999 git@bitbucket.org whoami'
sh 'git submodule update --init --recursive'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment