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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CALwR_haNkO%2BN9_wusR08AaH8X2C7gwEVJT%2BQUF%3Dka0Bxv3sP%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to