Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ssh_key.rb #2075

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/travis/build/bash/travis_disable_ssh_roaming.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ travis_disable_ssh_roaming() {
mkdir -p "${TRAVIS_HOME}/.ssh"
chmod 0700 "${TRAVIS_HOME}/.ssh"
touch "${TRAVIS_HOME}/.ssh/config"
ssh-keygen -R github.com
curl -L https://api.github.com/meta | jq -r ".ssh_keys | .[]" | sed -e "s/^/github.com /" >> ~/.ssh/known_hosts
echo -e "Host *\\n UseRoaming no\\n" |
cat - "${TRAVIS_HOME}/.ssh/config" >"${TRAVIS_HOME}/.ssh/config.tmp" &&
mv "${TRAVIS_HOME}/.ssh/config.tmp" "${TRAVIS_HOME}/.ssh/config"
Expand Down
4 changes: 3 additions & 1 deletion lib/travis/vcs/git/ssh_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ def apply
sh.chmod 600, '~/.ssh/id_rsa', echo: false
sh.raw 'eval `ssh-agent` &> /dev/null'
sh.raw 'ssh-add ~/.ssh/id_rsa &> /dev/null'
sh.raw 'ssh-keygen -R github.com'
sh.raw 'curl -L https://api.github.com/meta | jq -r ".ssh_keys | .[]" | sed -e "s/^/github.com /" >> ~/.ssh/known_hosts'

# BatchMode - If set to 'yes', passphrase/password querying will be disabled.
# TODO ... how to solve StrictHostKeyChecking correctly? deploy a known_hosts file?
sh.file '~/.ssh/config', "Host #{data.source_host}\n\tBatchMode yes\n\tStrictHostKeyChecking no\n", append: true
sh.file '~/.ssh/config', "Host #{data.source_host}\n\tBatchMode yes\n", append: true
end

private
Expand Down