You can try " Building a project hosted on Github using an instance of Openshift Jenkins " by Ramzi MaΓ’lej.
Ensure that Openshift does not provide write permissions in multiple folders on the Jenkins instance, for example: .ssh , .m2 . (or ssh will not work anyway, because of the permissions on the folders are "too permissive")
This in itself may be the source of your problems, but if that is not enough, read on.
Then:
rhc ssh buildserver mkdir app-root/data/git-ssh ssh-keygen -t rsa -b 4096 -C " youremail@yourdomain.com " -f $OPENSHIFT_DATA_DIR/git-ssh/id_rsa
Expand $OPENSHIFT_DATA_DIR/git-ssh/id_rsa.pub into your GitHub account
Create a script ssh-wrapper.sh that does the following:
#!/bin/bash ID_RSA="$OPENSHIFT_DATA_DIR/git-ssh/id_rsa" KNOWN_HOSTS="$OPENSHIFT_DATA_DIR/git-ssh/known_hosts" ssh -o UserKnownHostsFile=$KNOWN_HOSTS -i $ID_RSA $1 $2
Remember to make it doable: chmod +x ssh-wrapper.sh
Check it:
./ssh-wrapper.sh -T git@github.com Hi Jenkins! You've successfully authenticated, but GitHub does not provide shell access.
Finally, configure Jenkins:
go to Manage Jenkins > Configure System > Global Properties and create a new environment variable called GIT_SSH that refers to the place where you created your wrapper.
source share