Problems with configuring ssh credentials for gitlab plugin

90 views
Skip to first unread message

Parichay Barpanda

unread,
Mar 28, 2019, 10:20:50 PM3/28/19
to Jenkins User Experience
I am running a Bitnami Jenkins Stack Cloud on Azure. 

Issue: Unable to ssh clone from Gitlab account.

Steps:
1) Create a pipeline job
2) Select Source Code Management -> Git
3) Add gitlab ssh clone url
4) Add credentials -> SSH with username (username: git, passphrase: xxx)

In bitnami jenkins stack, the jenkins instance run on a user called tomcat. So, I added ssh-key pair for that user, and added the public key to my Gitlab account. 

When I follow the above steps while configuring pipeline job, I receive an error:

Failed to connect to repository : Command "/opt/bitnami/git/bin/git ls-remote -h g...@gitlab.com:baymac/building-a-multibranch-pipeline-project.git HEAD" returned status code 128:
stdout: 
stderr: ssh: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by ssh)
ssh: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by ssh)
Permission denied (publickey). 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

To verify if it is working, according to the Bitnami docs, I ran the same command the pipeline job runs:

tomcat@bitnami-jenkins-2c92$ /opt/bitnami/git/bin/git ls-remote -h g...@gitlab.com:baymac/building-a-multibranch-pipeline-project.git HEAD

/usr/bin/ssh: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by /usr/bin/ssh)
/usr/bin/ssh: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by /usr/bin/ssh)
Enter passphrase for key '/home/tomcat/.ssh/id_rsa': 

The ssh connection is validated! The same command is executed by the job but it returns a status code 128. I elevated the permissions of the Jenkins user to max but nothing changed.

Possible problems could be in providing the wrong details of credentials but I cannot figure it out, I have tried numerous other combinations by giving the private key directly also but it doesn't work. Some help would be highly appreciaated.

Parichay Barpanda

unread,
Mar 28, 2019, 10:48:56 PM3/28/19
to Jenkins User Experience
Had a little success. 

Initially I generated my ssh key using `ssh-keygen`, the private key looked like:

—–BEGIN RSA PRIVATE KEY—–
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,AB8E2B5B2D989271273F6730B6F9C687

……………………………………………….
……………………………………………….
………………………………………
—–END RSA PRIVATE KEY—–


Later, I generated a simple private using a online tool, the private key looks like this:

—–BEGIN RSA PRIVATE KEY—–

……………………………………………….
……………………………………………….
………………………………………
—–END RSA PRIVATE KEY—–


Now this works! 
Reply all
Reply to author
Forward
0 new messages