Quick Note: Before anyone points it out, I did originally post this on Server Fault, but after doing so I realized this site may be more appropriate. Sorry for the "double post".
I had installed gitolite about 6 months ago and all of a sudden I started getting this error:
fatal: 'gitolite-admin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
I have read a lot of other topics on this and done everything they suggested from removing the auth keys and adding a config file in ~/.ssh. Mine is below:
host myhost
user git
hostname myhost
port 22
identityfile ~/.ssh/id_rsa
host mygit
user git
hostname myhost
port 22
identityfile ~/.ssh/obto
Sadly, though, I'm still getting the fatal error. Does anyone have any ideas?
I solved this issue by doing what you just said: I create a file called config in my client machine:
vim ~/.ssh/config
Host 192.168.0.14
user git
hostname 192.168.0.14
port 22
identityfile ~/.ssh/userX
The userX file is your public file (userX.pub). Then I cloned the gitolite-admin repository in my client machine by doing:
**git clone 192.168.0.14:gitolite-admin**
Cloning into 'gitolite-admin'... Enter passphrase for key
'/home/userX':
Now you should enter the password of your key. And that's it. I hope this helps.
Regards.
Related
my ssh config was okay and it was working fine, however recently my Github ssh connection didn't work and also I wasn't able to connect to my private server using ssh connection. When I try to ssh, I get follwing error:
/home/hacku/.ssh/config: line 9: Bad configuration option: Identityfile
/home/hacku/.ssh/config: line 16: Bad configuration option: Identityfile
/home/hacku/.ssh/config: terminating, 2 bad configuration options
And here is my config file:
Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh/github_ssh
TCPKeepAlive yes
Host linode
HostName serv_ip_address
User hackU
Port 22
IdentityFile ~/.ssh/private_key
I copied exact same config file and my private key into another machine and it worked great (Termux, ssh version => OpenSSH_8.6p1, OpenSSL 1.1.1l 24 Aug 2021).
I checked my ssh package version it was OpenSSH_8.7p1, so I thought maybe the update broke it. So I downgraded it to OpenSSH_8.6p1, OpenSSL 1.1.1l 24 Aug 2021, it also didn't work, additionally I tried to restart sshd by using
sudo systemctl restart sshd
But none of the above worked.
I'm using manjaro gnome edition as my daily driver.
Thanks beforehand.
Everything theoretically seemed okay but the thing was that it was weirdly throwing this error. After doing some reading, I found this information here:
if you use an ssh-agent, ssh will automatically try to use the keys in the agent, even if you have not specified them with in ssh_config's IdentityFile (or -i) option. This is a common reason you might get the Too many authentication failures for user error. Using the IdentitiesOnly yes option will disable this behavior.
So I completely deleted IdentityFile option. Hence my final config file is like that and both connection works just fine.
Host github.com
User git
Port 22
Hostname github.com
TCPKeepAlive yes
Host linode
HostName server_ip_address
User hackU
Port 22
However, the reason for the problem for me still is unknown. I would be glad to hear, in case someone finds it out.
When I try to clone the repository in Linux machine I am facing the below issue
-bash-4.1$ git clone
ssh://xxxxx#alm.oraclecorp.com:2222/epm_pbcs_15318/pbcs.git
Initialized empty Git repository in /home/xxxx/testgit/pbcs/.git/
Permission denied (keyboard-interactive,publickey).
fatal: The remote end hung up unexpectedly
Note:- I have added public ssh key in the repository
I have generated a key in my Linux machine using
ssh-keygen -t rsa -C "email#gmail.com"
and later on, copied the public key to alm where the GIT is hosted.
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwVM4haHIEOk6P7+h4xEDyZBrGjSLx53jNFE1AqMNWnPKWwxpGX5w4l/B0WJpP7G9gLJaZPw9loSEDDr3mGx5bRi3D8k6EFgFMpctALJlKTHFW1x47A1Z+0h2GZUvL5WZj1ZXicvpbHRxX5B+FB8s+b2d3uvwVVl26lIK3f6K2iUiRePlUH/1TPBTk/kzxvDBZQCRQKxM4Zb13S7b9WJcxt85g3+jCIebDbAaswUmIeWicM+BREmcP75ZV6ZEF1cBB54TvMrygsTzJacQS6/IsobOaZpWM7iVXTnEGjFh8iKCA5VacMMEt+QR8kc/CGOm1ujcNFbK6hikp2CpSOo4wQ== email#gmail.co
Please help me if there is any way to fix it
I think your problem is that you are not using your private key to connect to that repository.
The easiest way to do it is by adding the following lines to either ~/.ssh/config or /etc/ssh/ssh_config, please be careful and add the lines at the beggining of the file, * configuration must be at the end of the /etc/ssh/ssh_config (if you use this file for configuration):
Host alm.oraclecorp.com
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
IdentityFile YOUR_PRIVATE_KEY_LOCATION
Port 2222
User YOUR_USER
REMEMBER TO EDIT YOUR_PRIVATE_KEY_LOCATION AND YOUR_USER with your data
Let me know if this worked.
BR
I am using CentOS7.
I have tried to set connection between my local git repository and remote git repository on github.com. But my local repository is at work and it is behind the proxy.
I have found a lot of answers on stackoverflow about this problem. Maybe I am not so attentive and so on...but I haven't resolved my problem yet.
My steps were:
Creation of repository at github.com
Generating SSH keys using this tutorial https://help.github.com/articles/generating-ssh-keys/
But on "Step 5: Test the connection" in link-tutorial after using command ssh -T git#github.com
I was a little bit confused.
Connection did not work and I got this error:
ssh: Could not resolve hostname github.com: Name or service not known
Blockquote
At first I tried to set proxy in git config file:
git config --global http.proxy http://http://192.168.32.2:3128 But the result was the same I couldn't connect to my remote repository.
Next step was to set address of github.com in /etc/hosts as : 192.30.252.0 github.com
Address for github.com I took from here https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist/.
After using command ssh -T git#github.com everything just hang up.
Despite the fact that connection through ssh did not work I tried to clone repository from my remote github account to my local account at work: git clone https://github.com/Nit84/hello-world.git. And everything copied as it should be and without any password.
At this point I just got stack. And I haven't the faintest idea what to do further.
Here is a list of my configurations using git config --list:
[root#localhost hello-world]# git config --list
user.name=Nit84
user.email=blob#gmail.com
core.editor=vim
http.proxy=http://192.168.32.2:3128
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=ssh://git#github.com/Nit84/hello-world.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
and here is the verbose mode of ssh -vT git#github.com:
[root#localhost hello-world]# ssh -vT github.com
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
ssh: Could not resolve hostname github.com: Name or service not known
Is there any way to resolve my problem with connection between git local and remote repository using ssh-keys over proxy? Simply saying I want my command ssh -T git#github.com works as it is described in genereting ssh keys
I have created a new GIT repository in my server at /home/myuser/.git/project.git.
I found ssh key for git from C:\Users\Toshiba\.ssh\github_rsa.pub & appended with server's authorized_keys file.
when i try to do git clone using ssh it fails as below.
$ git clone ssh://myuser#mysite.net:2888/home/myuser/.git/project.git
Cloning into 'project'...
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Could you please help me in resolving this issue.
If your public/private key doesn't have the standard name C:\Users\Toshiba\.ssh\id_rsa(.pub), but C:\Users\Toshiba\.ssh\github_rsa.pub, then you need an ssh config file
Host mysite
Hostname mysite.net
User myuser
Port 2888
IdentityFile C:\Users\Toshiba\.ssh\github_rsa.pub
That would allow you to do
git clone mysite:/home/myuser/.git/project.git
Test it first wih ssh -Tvvv mysite, and then ssh mysite ls.
Make sure the environment variable %HOME% is defined to C:\Users\Toshiba
You have another example in "SSH error on push to an existing project Permission denied (publickey)"
I'm setting up gitolite for first time. I'm following this instructions.
When I ssh, it looks fine:
$ ssh -p 2222 gitolite#debian
PTY allocation request failed on channel 0
hello gitolite, this is gitolite#debian running gitolite3 v3.5.3.1-1-gf8776f5 on git 1.7.2.5
R W gitolite-admin
R W testing
Connection to debian closed.
But when trying to clone, it gives me the following error:
$ git clone ssh://gitolite#debian:2222/home/gitolite/repositories/gitolite-admin.git
Cloning into 'gitolite-admin'...
FATAL: R any home/gitolite/repositories/gitolite-admin gitolite DENIED by fallthru
(or you mis-spelled the reponame)
fatal: The remote end hung up unexpectedly
I'm trying to clone from yasin#vonneumann account. I uploaded this user RSA public key to debian server, renamed it to gitolite.pub and ran gitolite setup -pk gitolite.pub with no messages or errors. Then at yasin#vonneumann host I created a file at ~/.ssh/config with the following content:
host debian
user gitolite
hostname debian
identityfile ~/.ssh/gitolite
(I also copied id_rsa as gitolite at vonneumann)
I found this question to be similar, but the answers did not work for me.
Any help appreciated, thanks.
If you have a ~/.ssh/config file, you need to use the scp-like syntax for your ssh url:
git clone debian:gitolite-admin.git
With a config like:
host debian
user gitolite
hostname debian
identityfile ~/.ssh/gitolite
port 2222
And you are not supposed to specify the full path of the repo.