I get Host key verification failed error whenever I try to put my GITLAB git address into Jenkins.
I've tried:
- using multiple different SSH paths. Including removing : and replacing /. Used http
- I've ssh and tried to run the command in the terminal, when prompted to say y/n I pressed Y.
- It works with Github.
- I've tried going to my jenkins/.ssh/ida_pub and adding my keys.
Failed to connect to repository : Command "/usr/local/git/bin/git ls-remote -h git#:/.git HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If you make the repo you are trying to connect to public in Gitlab (Settings -> Edit Project -> Public mode) you should be able to connect using http (but only http).
If the repo is not public you will need to install an SSH key on Jenkins that has permissions to access the repo. My understanding is that the Jenkins git plugin does not currently use the SSH credentials already stored in Jenkins so you will need to install the key on the master and slaves that will run this build. How you do this will depend on your OS but I find it easiest to use an SSH config file on Linux.
Related
I have setup SSH key on CENTOS 7 server and also have added SSH in my Bitbucket personal settings. But still I am getting Jenkins error as:
Although I have setup ssh key on CENTOS 7 server where the Jenkins is installed. On running ssh -v git#bitbucket.org command in terminal I am getting a number of lines and it seems that the connection has been established successfully. The terminal output was:
But still I am getting authentication error.
I have tried other solutions like Jenkins Shared Library: Permission denied (publickey) and Jenkins : stderr: Permission denied (publickey). fatal: The remote end hung up unexpectedly But none of them worked. Please help me.
I think your Repository URL is not correct. If you have setup SSH connection in bitbucket then you should use url accordingly.
Go to Bitbucket and click on clone button ion your repository.
Select SSH on the top right of the dialogue being displayed.
Copy the url written after git clone keyword. It will go like
git#.....
That should work.
I'm trying to connect to Windows agent use SSh(Launch agent agents via SSH)
Jenkins master(in Linux)
log:
[SSH] Opening SSH connection to 192.168.0.122:22.
[SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
ERROR: Server rejected the 1 private key(s) for my_bot (**********)
[SSH] Authentication failed.
Authentication failed.
Launch failed - cleaning up connection
[SSH] Connection closed.
I tried to add key to authorized_keys.. but it did not help
When ssh says "SSH host key" it means the keys in known_hosts.
Check .ssh/known_hosts to see that key.
Although "Connection will be allowed" implies this is not a problem for you.
So ignore that part of the error message.
Your real problem is "ERROR: Server rejected the 1 private key"...
Is they key exchanged ok?
Private key needs to be in jenkins. Also check file permissions.
Public key needs to be on server side. Probably .ssh/authorized_keys. Also check file permissions. Ssh will not allow keys to be used if permissions on .ssh or files contained inside are too open.
More information is needed to help solve the question:
In your question please show the ssh command you use - the full command - do you specify key with -i parameter ?
From jenkins command-line, can you ssh to the host using the same ssh command ?
Do ls -al on jenkins home .ssh dir and on server side .ssh dir to check permissions.
To get more verbose/debug information add -v or -vv or -vvv to your ssh command.
Also look at ssh logs on server side if possible.
In your question you could tidy up the log messages.
Same error seen on this question here and I can see they did chown 744 .ssh/authorized_keys in dockerfile which is the wrong way to set permissions for an authorized_keys file.
https://superuser.com/questions/1403715/why-i-am-getting-error-server-rejected-the-1-private-key-error-on-setting-up-s/1443503#1443503
I configured capitrano to deploy a Rails app from Git bash on Windows. I created one rsa key to connect to the remote server with the user deploy and another rsa key to connect to bitbucket with my account.
Before deploying I set up the ssh-agent with both keys.
When deploying I have an authentication failed (publickey error) nevertheless when I try to ssh deploy#myserver.com it works and from inside my server if I try git -T git://bitbucket.org it connects and show me my username.
How can I debug this issue?
The issue was that the ssh client used by capitrano doesn't handle ssh-agent on Windows. The solution was to use Pageant the agent of the putty project but before importing keys to pageant they have to be converted to the ppk format by puttykeygen
I'm just starting out with jenkins and I'm having trouble to connect to a remote machine via rsync.
I guess jenkins doesn't know which ssh identity file to use or maybe it knows, but doesn't know how to decrypt it? From other questions i gathered that the Gtk-Warning is probably because it can't open the "enter keyphrase"-prompt.
rsync -azvh /var/lib/jenkins/workspace/ofen sascha#my_server:/my_project/ofen
No protocol specified
(ssh-askpass:19928): Gtk-WARNING **: cannot open display: :0
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.0]
Everything works fine when I try it from commandline.
Need to have the key loaded as part of Jenkin's SSH Agent configuration.
Add the private key to Jenkins via credentials/SSH private key including pass phrase if one is used
Enable SSH agent on the job and give it the credential
Things that use SSH keys and agents can now use the loaded key.
The "identity" depends on where your job is running:
when running on the master, it's the user that runs Jenkins
on a slave, it's the user that you use for connecting the slave
You need to add the public key of that identity to the .ssh/authorized_keys file of user sascha. This will enable public key-based authentication and rsync should run just fine.
To set the context, I am trying to use the toto to set up my blog.
I did
$ sudo gem install toto
and the gems were installed properly.
Successfully installed rdiscount-1.6.8
Successfully installed toto-0.4.9
2 gems installed
After that, I tried
$ git clone git://github.com/cloudhead/dorothy.git myblog
but I get the following error
Cloning into myblog...
github.com[0: 207.97.227.239]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)
My git http proxy settings are correct
jatin#jatin-ubuntu:~/myblog$ git config --global http.proxy
http://proxy:port
My http_proxy settings are also correct
jatin#jatin-ubuntu:~$ echo $http_proxy
http://proxy:port/
So, I replaced git by http, as
$ git clone http://github.com/cloudhead/dorothy.git myblog
and it worked.
Now, when I do the following
$ cd myblog
$ heroku create myblog
it works till here and I get
Creating myblog...... done
Created http://myblog.heroku.com/ | git#heroku.com:myblog.git
Git remote heroku added
But it fails down here:
$ git push heroku master
and the following error comes up
ssh: connect to host heroku.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly
I didn't know what to do, so after Googling a bit I found that you can't push changes to github using http.
On digging in further, I found this link
how-to-use-the-git-protocol-through-a-http-connect-proxy
which says that you can have your firewall administrator configure the proxy to also allow CONNECT for port 9418, which is the port used by git.
Once they have appropriately configured the proxy, you should then be able to use tools like netcat-openbsd or socat to connect through.
My problem is that I am a student and I can't get around this because I can't reach out to the administrator. I don't know what to do, as I am still stuck looking for an answer.
You added the heroku remote using this URL git#heroku.com:myblog.git. This was probably configured by the heroku create command.
When you push to this remote, it is done via SSH. And this is exactly what the error message indicates: that you (or git) tried to ssh to heroku.com, but couldn't because of your firewall (probably) denied that. With your git push heroku master command, you are not pushing to Github, but to the git repository at Heroku. To push your stuff to Github, you need to git push origin master and use either ssh or http for the transport. The git:// protocol itself does not support pushing changesets but is an unauthenticated re-only protocol.
Currently, Heroku seems to only allow the SSH transport for its git repos and there don't seem to be any direct hooks on Github (see Push from github to heroku without downloading repo). This means to publish your apps on Heroku, you need to be able to push to heroku.com via SSH from your local host.
You can also push to https://cloudhead#github.com/cloudhead/dorothy.git (note the username in the url).
When you push to this remote, it is done via SSH. The error you are getting is because the client could not connect via SSH, most likely because you are behind some type of firewall that is preventing the connection. I used to have this same problem when trying to push to Heroku from work.
My suggestion would be for you to develop locally and then go to some public hotspot to push the changes to Heroku (like a Starbucks).