H
H
HoHsi2016-04-06 12:44:57
git
HoHsi, 2016-04-06 12:44:57

How to SSH into a Git server from Bash?

Good afternoon!
The task is to clone the git repository in jenkins using the Shell script:

whoami # => SYSTEM

# Запрос делается с виндовой машины
# В файле лежит RSA private key
ssh_id_rsa_path="C:/jgit/id_rsa"

eval $(ssh-agent -s)
ssh-add $ssh_id_rsa_path

# Url и схему менять нельзя, запрос только по SSH
git clone ssh://[email protected]/user/reponame/reponame.git
# => Host key verification failed.

At the time the script is run, the user is SYSTEM , and the rights on the server are given to jenkins .
How to make it so that a request from jenkins from a shell script comes to git?
This cannot be done through the Git plugin for jenkins, for a number of reasons. SSH agent plugin doesn't work either.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2016-04-06
@plin2s

ssh://[email protected]/user/reponame/reponame.git
Or am I misunderstanding something.

P
Pavel Selivanov, 2016-04-06
@selivanov_pavel

export GIT_SSH_COMMAND="ssh -i $ssh_id_rsa_path"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question