2

I am trying to setup an automated pipeline between Jenkins and Gogs and am having some issues with connecting the two together. I feel like I have followed the process correctly but am still receiving a 401 at the end of it.

Here are the steps I have undertaken:

1) Log into my jenkins master server and log into the jenkins user

2) generate a key pair

ssh-keygen -t rsa -b 4096 -C "sysadmin@email.ca"

3) Added Private key to jenkins under global credentials

4) Added public key to Gogs

5) Go to create a new pipeline, when I enter the repository name I get the following erorr:

Help for feature: Repository URL
Failed to connect to repository : Command "git ls-remote -h https://www-git1.mmm.local/git-admin/SF-Firefly-RK3399 HEAD" returned status code 128:
stdout: 
stderr: error: The requested URL returned error: 401 Unauthorized while accessing https://www-git1.mmm.local/git-admin/SF-Firefly-RK3399/info/refs
fatal: HTTP request failed

UPDATE:

So I am not sure if this will be an issue but I realized that my gogs server and jenkins master are running two different versions of git:

Gogs: git version 1.8.3.1 Jenkins: git version 1.7.1

Could this be the source of my problem?

1

Jenkins understood that you want to use https protocol with git. Maybe you've put www-git1.mmm.local/git-admin/SF-Firefly-RK3399 and it got converted to https://www-git1.mmm.local/git-admin/SF-Firefly-RK3399

As you have generated ssh keys, it maybe best to explicitly set ssh://username@www-git1.mmm.local/opt/local/absolute/path/to/repo as your git url.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.