The solution is to create id_rsa file manually in shell like this:

cat <<EOF >/root/.ssh/id_rsa-----BEGIN RSA PRIVATE KEY-----
content of the file-----END RSA PRIVATE KEY-----
EOF
chmod 400 ~/.ssh/id_rsa


среда, 29 марта 2017 г., 11:22:21 UTC+3 пользователь Alexey Lukin написал:
>
> I need to use jenkins job to synchronize two repositories. So I have 
> created a job, added two git repositories using Multiple SCMs plugin 
> <http://wiki.jenkins-ci.org/display/JENKINS/Multiple+SCMs+Plugin>.
>
> And added shell commands, example:
>
> cd first_project
> sha=`cat last_commit_merged`
> cd ..
> cd second_project
> new_sha=`git rev-parse HEAD`
> git diff-index "$sha" --binary > my.patch
> cd ..
> cd first_project
> if [ "$sha" != "$new_sha" ]
> then
>   git apply ../second_project/my.patch
>   echo "$new_sha" > last_commit_merged
>   git add .
>   git commit -m "New sync, date `date +'%Y-%m-%d %H:%M:%S'`";
>   git push origin HEAD
> fi
>
> So when job starts, it successfully clones both repositories in folders: 
> first_project and second_project, I could create my.patch, apply it and 
> commit, but command:
> git push origin HEAD does not work and I could not figure out how to setup 
> correctly git in shell to make it working, the error is:
>
>
> + git push origin HEAD
> Permission denied (publickey).
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the repository exists.
> Build step 'Execute shell' marked build as failure
> Finished: FAILURE
>
>
> -- 
>
> Alexey Lukin
> Ruby on Rails developer
>
> skype:real_virtuoz
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b846bd65-3ffe-49af-9e0d-815926e742dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to