gitlab error - the remote en hung up unexpectedly - gitlab

I installed Gitlab on my Ubuntu successfully(gitlab.domain.com), on a client PC I installed Git (windows 7), then run Git Bash to generate SSH keys with command: ssh-keygen -t rsa -C "username#domain.com" to create private/public keys on C:\Users\AccountName.ssh
Then, add public key to profile on installed gitlab. Then can clone/push on Git Bash.
However, I can not reproduce this on other PCs, I tried some PCs, created new users, new ssh keys...
but always encounter that error "The remote end hung up unexpectedly", sometimes can clone but also get that error when pushing.
I can only clone/push on first PC. I'm so confused, don't know what I missed. I'm trying to get my team on Git
Thanks a lot for any advice

Make sure you are pointing it at the correct git server. Also - login on your Jenkins server (Under the jenkins user) and ssh to git#your-git-server and make sure to select 'yes' to add the server to your known hosts.

I had the same error and it was an access-level problem :
my user only had guest access to my project so it wasn't able to clone it. I changed the access level to developper and it solved my problem

Related

How do I use the right key for SSH, connecting from Git Bash on Windows to remote server?

I'm trying to push my project on git to my remote Linux server from my local Windows PC.
I have no issues connecting to my server through SSH when I use PuTTY. But PuTTY is only for the remote server, and doesn't let me look in my own local pc - so I can't access my git repository to push from.
Instead I've been trying with Git Bash, where I go to the repository(master) of my git project, and then attempt "git push production master". Receiving "Permission denied (publickey)" in response in Git Bash.
I have loaded by private key from my user/.ssh folder on local pc, using PuTTYgen, copy/pasted the public key it shows into my Github account's SSH-keys.
This is the same key that I use for connecting with PuTTY(which works).
If I use "git remote -v" in Git Bash, I receive what is the correct url for the server:
"
production ssh://notacop#mafiauniversedata.com/var/repo/site.git (fetch)
production ssh://notacop#mafiauniversedata.com/var/repo/site.git (push)
"
"notacop" is the admin user I made instead of root, which is also the one that I use in PuTTY.
If I attempt "ssh notacop#mafiauniversedata.com" in Git Bash I also receive the "Permission denied (publickey)" response. So seemingly the issue is related to the publickey that Git Bash uses, as it can't connect at all.
My user/.ssh folder contains:
digitalocean_private_key (is the one PuTTY uses/the one generated by PuTTYgen) + digitalocean_public_key
github_rsa + github_rsa.pub
id_rsa + id_rsa.pub
known_hosts
I feel like I've set things up in accordance with the general guidelines, and it does work in PuTTY, so the issue must be related to Git Bash and how Git Bash establishes ssh connection.
But I'm fairly clueless about how to fix the issue, and haven't been able to find a solution from searching. My guess is that it's something fairly simple, but I've been stuck on this for a couple weeks now, not getting anywhere because of it.
Any answers that can lead me in the right direction will be highly appreciated!
If anything about my question is unclear, or you need more information to answer, please let me know.
I don't know why Git Bash's own ssh doesn't seem to work for you,
but I have a better recommendation: make Git Bash use PuTTY, by setting the GIT_SSH environment variable to the path of plink.exe (that's not a typo, it's not putty.exe, but another executable that comes with the zip of PuTTY tools).
The main advantage and reason to do this is so that Git Bash can benefit from pagent.exe, the key manager of PuTTY.
So that you can enter your passphrase once,
when adding your private key to Pagent,
and then you don't need to re-enter it every time you perform remote operations in Git Bash.

GitHub SSH access not working

I have created a new user on github under our organization which will be used for auto deployment. I followed the article on https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#platform-linux.
Somehow, when I tried to clone the repository to the server, it worked once. The code was running properly, and I exit the server. Today, we released an update to the code, and I wanted to deploy the code manually to the server, so I ssh'd into the server and tried to pull the repository with git pull. It gave me Permission denied error. After some debugging I realized that the ssh-agent wasn't running. So I executed the following commands:
eval "$(ssh-agent -s)"
ssh-add .ssh/id_rsa_staging
Now, when I try ssh -T git#github.com, I see the welcome message which is:
Hi *****! You've successfully authenticated, but GitHub does not provide shell access.
But when I try to pull from the repository, I am continuously getting this error message:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I checked the repository and the user has read access to it. I double checked if the keys match on github and server, yes they do. I tried generating new keys. I tried using ssh/config file. Nothing helped...
I appreciate any help & suggestions!
Update:
So I figured out that git clone command is working properly, but even when I try git pull right after git clone, it is giving the error.
If you are using sudo to git pull/push to the remote you need to ensure you used sudo to generate your SSH keys. Otherwise you will not be using the same keys that you originally generated.
github doc for reference
I had the exact same issue.
For me what worked was
Go to repo on github which you have cloned and wanna pull with
Under the code-download option copy SSH link
Enter following command in your terminal -->
git remote set-url origin paste_SSH_link

Installing git repository on Oracle Enterprise Linux 5 -- SSH problems

I have been banging my head against a wall for a while now, and none of the people in my immediate vicinity know more than I do at this point.
My office has a lab box that they want to use for a central git repository -- mainly for testing various things. They also, of course, want me to get some experience setting up git so that we can possibly set up other git instances later.
I am running Windows 7 with an OEL 5.7 VM, and the box is running OEL 5.5. From my VM, I SSHed into the lab box and started tinkering. After installing git and gitosis, I have managed to get the instance working locally. I can see the git repository just fine, and if I try to clone it locally, it all works like a dream. But if I try to SSH in from my VM, it either A.) kicks me out with fatal: 'testproject.git' does not appear to be a git repository or B.) kicks me out with Permission denied (publickey,gssapi-with-mic), depending on how I invoke git.
Example: I configured the access to a test project I created (and tested locally) as follows:
[group team]
writable = testproject
members = oracle#RCSDB cwerness cwerness#localhost cwerness#localhost.localdomain
This is my first experience setting up a git repository, so I wanted to cover my bases regarding remote users. Thus, the redundancy in the members section.
When I try to clone the repository with my username only, I get
[cwerness#localhost Desktop]$ git clone cwerness#10.1.1.10:testproject.git
Cloning into testproject...
Enter passphrase for key '/home/cwerness/.ssh/id_rsa':
fatal: 'testproject.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
If, however, I try to clone the repository with more information, I get
[cwerness#localhost Desktop]$ git clone "cwerness#localhost.localdomain"#10.1.1.10:testproject.git
Cloning into testproject...
Permission denied (publickey,gssapi-with-mic).
fatal: The remote end hung up unexpectedly
I have all the public keys stored in the /keydir folders. The repository was created and is owned by the user oracle, and I have tried all permutations of that user and its domain in the above clone commands as well, to no effect. Additionally, I tried setting up a ~/.ssh/config file like this
Host labbox
Hostname 10.1.1.10
User cwerness
IdentityFile /home/cwerness/.ssh/id_rsa
Again, I tried all the different ways to connect, from both users. Nothing is giving me any more information than I already had.
The box is set up to authenticate SSH connections via public keys, and that works fine. I can SSH into the box as cwerness with no problems.
This is getting to be a huge headache for me, and I'd like it if someone could tell me exactly HOW I am being stupid, if not a way to fix this problem.
git clone cwerness#10.1.1.10:testproject.git will look in the home directory for the user cwerness but you state you put the repository in /home/oracle/repositories. Try git clone cwerness#10.1.1.10:/home/oracle/repositories/testproject.git.

How can I get git to work with a remote server?

I am the CM person for a small company that just started using Git. We have two Git repositories currently hosted on a Windows box that is our all-purpose Windows server. But, we just set up a dedicated server for our CM software on an Ubuntu Linux server named "Callisto".
So I created a test Git repository on Callisto. I gave its directory all of the proper permissions recursively. I had the sysadmin create a login for me on Callisto, and I created a key to use for logging in via SSH. I set up my key to use a passphrase; I don't know if that could be contributing to my problems? Anyway, I know my SSH login works because I tested it through puTTY.
But, even after hours of trials and head scratching, I can't get my Windows Git bash (mSysGit) to talk to Callisto for the purposes of pushing or pulling Callisto's git repository files.
I keep getting "Fatal error. The remote end hung up unexpectedly." And I've even gotten the error that Git doesn't recognize the test repository on Callisto as a git repository. I read online that the "Fatal error...hung up unexpectedly" is usually a problem with the server connection or permissions. So what am I missing or overlooking here? And why doesn't a pull using the git:// protocol work, since that only uses read-only access? Group and public permissions for the git repository's directory on Callisto are set to read and execute, but not write.
If anyone could help, I would be so grateful. Thank you.
If you use putty/pageant, check if your host is in the know_hosts file in
docssettings/userdir/.ssh
If not, try putty first and accept the key your server provides.
Do you have similar lines in .git/config?
[remote "origin"]
url = ssh://user#server/.../repo.git
I have only passing familiarity with mSysGit, but I don't think it installs an ssh client. Without the ssh client, git cannot connect to the server. (This functionality isn't baked into git as per the Unix philosophy.) As for the git protocol, unless the server has that enabled, it won't work. Since it seems you have the server setup for ssh access, I doubt you'll get anywhere with the git protocol.
Anyway, I know my SSH login works
because I tested it through puTTY.
Have you confirmed that you can SSH to the server from your msysgit client?
i.e. what happens when you ssh user#callisto.com from the msysgit command line?
For further details about setting up your git server, you may want to review Pro Git: Chapter 4 "Git on the Server".
And why doesn't a pull using the
git:// protocol work, since that only
uses read-only access?
For the git protocol to work, you must setup the git daemon on your server as described in Chapter 4.9 of Pro Git.
You may also want to take a look at this answer to a related SO question. It has a more detailed checklist of things to consider.

Clone TFS-GIT repository to GIT repository (Linux) by using GIT

We have Redhat Linux server, GIT was already installed on this server and we need to create a local repository.
We have TFS-GIT project in TFS 2015, we need to clone the TFS-GIT repository to the GIT repository on Linux by using GIT commands.
For this task, we created a empty local repository on Linux, and configured the basic authentication and configured the SSL certification by using server manager.
Still getting "Fatal: authentication error" to connecting TFS-GIT repository on windows server 2012 . We tried in different ways but still we are getting same error.
Am using my basic credentials like which I used for server logins and I have only id and password for everything.
Is there any specific kind of passsord I need to use for this?
Please advise me on this
Thanks in advance
You have done all as it should be.
You need to copy your public key of the desired user to the Unix server as well so it will work.
How to setup ssh-key?
# generate the key (local machine)
ssh-keygen -t rsa
# copy the generated key to your unix machine (server)
# the key is in : %HOME%/.ssh/id_rsa.pub
# In widows its under your user account: Users/<user_name>
Other ways
If you have only username and password you might need to use http/https.
Read here how to set it up/

Resources