Looks like switching to the jenkins user ssh-keys credentials helps move 
this forward. The errors I was getting first were directly in the 
configuration of Jenkins. Telling Jenkins to use the ssh-key for the 
Jenkins user gets me past that.

But on deploy, I'm still getting github errors.  When I run this command 
interactively:

SCM_BRANCH="master" /opt/ruby/current/bin/cap -v -f "./Capfile" 
pre_production deploy

The deploy works properly. But when Jenkins tries to run the same basic 
command, the console gives this error:

SCM_BRANCH=master
+ /opt/ruby/current/bin/cap -v -f /opt/jenkins/jobs/fw-test/workspace/Capfile 
pre_production deploy
 ** transaction: start
/opt/ruby/2.0.0-p353/lib/ruby/gems/2.0.0/gems/capistrano-2.12.0/lib/capistrano/recipes/deploy.rb:107:
 warning: Insecure world writable dir 
/opt/jenkins/tools/hudson.model.JDK/java_7_u55 in PATH, mode 040777
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
*** [deploy:update_code] rolling back
Command git ls-remote g...@github.com:ndlib/fw-test.git master returned status 
code pid 114306 exit 128
Build step 'Execute shell' marked build as failure


Any thoughts on what it does not like? 


Thanks,

Tom


On Monday, December 19, 2016 at 7:22:06 PM UTC-5, Mark Waite wrote:

> Did you define a credential for the access to that repository (using the 
> "Add" button on the job UI, or using the credentials section in "Manage 
> Jenkins")?
>
> Is the credential you defined a private key (not a username / password) 
> credential?  If not, it needs to be.
>
> Did you associate that credential with that repository URL in the job 
> definition?
>
> Is the public key for that private key registered with github as an 
> allowed public key for that repository?
>
> Are you using any entries in ~/.ssh/config to use unexpected or different 
> private keys in your access to the github repository?
>
> Mark Waite
>
> On Mon, Dec 19, 2016 at 2:10 PM <han...@nd.edu <javascript:>> wrote:
>
>> I'm attempting to pull from a private repository in GitHub. I have keys 
>> set up so that the jenkins user can pull from the repository but am having 
>> trouble with the Git plugin. When I set the repository URL to:
>>
>> g...@github.com/[myorg]/[myrepo] 
>> <http://g...@github.com/%5Bmyorg%5D/%5Bmyrepo%5D>
>>
>> I receive the error message:
>>
>> Failed to connect to repository : Command "git ls-remote -h 
>> g...@github.com:[myorg]/[myrepo] HEAD" returned status code 128:
>> stdout:
>> stderr: Permission denied (publickey).
>> fatal: The remote end hung up unexpectedly
>>
>> However, from the command line, this works:
>>
>> git ls-remote  g...@github.com:[myorg]/[myrepo] HEAD
>> d028a33d1bc3bc4cec49ae53f80f3eb58f09f13d HEAD
>>
>> and this also gives output:
>>
>> git ls-remote -h g...@github.com:[myorg/[myrepo]
>> d028a33d1423bc4cec49ae53f80f3eb5bc09f13d refs/heads/master
>>
>> It is the combination of using both -h and HEAD that gives bad output.
>>
>> Do I have something wrong with the repository?  Or something wrong with 
>> the plugin?  Or what am I missing here?
>>
>> Thanks,
>> Tom Hanstra
>> han...@nd.edu <javascript:>
>>
>>
>>
>>
>> -- 
>> 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-use...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/f1fb8b49-ed9f-4f19-ae6e-dc3960b5a212%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/f1fb8b49-ed9f-4f19-ae6e-dc3960b5a212%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/0adbd62c-fbb6-45a1-992a-2cf82cadf28d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to