Reputation: 4479
OK, So I spent years trying to set this jenkins server up and there is errors everywhere. Most answers out there are for linux, This jenkins server is on windows(if you know how to setup msbuild on a linux jenkins im all ears).
The server is set up exactly as it should, the last super super basic thing I'm doing is trying to pull the repo from aws codecommit, I have the right role and credetials.
I get this message
Jenkins Failed to connect to repository :
"git.exe ls-remote -h https://repo-url HEAD" Command returned status code 128:
it goes on to say
stderr: fatal: unable to access 'https://repo-url': The requested URL returned error: 403
However copy past that same command into a cmd window and It works just fine.
There is a plugin called codecommit-url-helper
, which was also installed and tried and all it did was take a huge squat on my hopes and dreams.
If your solution involves jenkins cli, just know I also tried that, but:
C:\Users\Administrator\Downloads> java -jar jenkins-cli.jar -s http://localhost:8080/ help
Sep 21, 2016 2:14:33 PM hudson.remoting.SynchronousCommandTransport$ReaderThread run
SEVERE: I/O error in channel Chunked connection to http://localhost:8080/cli
[UPDATE]
For those wondering I ended up doing two things, using git config --system
to configure the credentials with roles, and then I added the global username and email in the jenkins system settings under "Git plugin" one of them did it.
Upvotes: 2
Views: 8769
Reputation: 671
Another option is to leverage an IAM user and their Codecommit https credentials.
So, you can then add these credentials to Jenkins. In a Jenkins job you can then set them to be used when checking out from that repo.
Bear in mind though, that the IAM permissions should be controlled. You could simply allow that IAM user to have full access to Codecommit.
You can also use these credentials when writing Jenkins pipelines also.
Hope this helps.
Upvotes: 1
Reputation: 23078
RejeeshChandran
's answer is a good hint for solving the issue. Actual steps I have performed to get it done:
1) Generating a new SSH key and adding it to the ssh-agent using instruction provided here
2) Restart Jenkins service
3) git.exe ls-remote -h https://repo-url HEAD
command now works fine in Jenkins
Upvotes: 0
Reputation: 4358
It is good to use SSH key. SSH keys are a way to identify trusted computers without involving passwords. You can generate an SSH key and add the public key to your GitHub account. Please check How to Generate SSH in Github for more details
Upvotes: 0