Today i faced with below issue while the github was ported to some new hardware or network. So this resulted in below issue for the data pipeline i already had in my jenkins setup for Big Data.
Issue1: Below was due to issue2
ssh: Could not resolve hostname github.hpe.com: Temporary failure in name resolution fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Build step 'Execute shell' marked build as failure
Issue2:
Failed to connect to repository : Command "git ls-remote -h https://github.company.com/github_usrname/project_name.git HEAD" returned status code 128: stdout: stderr: fatal: unable to access 'https://github.company.com/github_usrname/project_name.git/': Could not resolve host: github.hpe.com; Unknown error
Solution:
Is to generate a personal access token by following below steps:
a) In your github link go to settings –> Developer settings –> Personal access tokens
b) Click on Generate new token
c) Update Jenkins credentials in your Job: (click on labels with ” ” below)
Top left “jenkins” –> “Credentials” –> Delete previous user and then recreate it.
d) If the issue1 persists update the ssh key from the linux system you are trying to use the git.
Go to https://github.company.com/settings/keys
Click on “New SSH key” and add the ssh key generated in your linux system.
[root@hostname project-pipeline]# ssh-keygen -t rsa -b 4096 -C “email_id@company.com”
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
5f:33:9a:df:3d:76:9c:ad:a3:b3:2e:b3:c3:a7:04:b8 email_id.g-n@company.com
The key’s randomart image is:
+–[ RSA 4096]—-+
| |
| |
| |
| . |
| . S + |
| . o + o |
| E .= .o|
| .=.o..=+|
| oO=++o+|
+—————–+
[root@hostname project-pipeline]# eval “$(ssh-agent -s)”
Agent pid 5742
[root@hostname project-pipeline]#
[root@hostname project-pipeline]# cat /root/.ssh/id_rsa.pub
starts with ssh-rsa*************
[root@hostname project-pipeline]#
Reference:
https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token