Cannot Clone GIT Repository from windows server but can SSH - windows

I have a seen a lot of posts related to the error I am getting but can't find anything that seems like a potential fix I would like to try without getting feedback from some people who know better.
The Setup: I recently built a Windows 7 PC and installed Apache, PHP and MySQL. Everything is working great with my setup and I opened the server up to other devices on the LAN. When I go to a browser and navigate to IPADDRESS:PORT (Installed Apache to listen on a custom port to avoid potential conflicts (Skype, future IIS install?, etc) I get my htdocs index.php page. Great so far.
The last thing I wanted to do was setup Git so that I can do work for my server on my Macbook Pro and push changes to the server. To get this up and running I installed msysgit on my server and was able to create a Git repository for a Media directory I created at the root of my server. When I open this directory up in Explorer I can see the .git directory. The next thing I did was install OpenSSH on the server and I got that up and running. I also changed the default home directory of an SSH connection to the htdocs folder of my Apache server.
Now when I move over to my Macbook pro to test the setup and I am getting problems.
SSH seems to be functioning as expected. When I am on my laptop and run ssh USERNAME#IPADDRESS I get the message to enter my password, I enter my login password and awesome I am in the shell of my server at the htdocs directory.
Git does not seem to be functioning as easily though. I have Git on my Macbook Pro and was able to create a repository in a local directory no problem. When I navigate to a new directory in Terminal that I would like to work with the Media folder project I created on the server and run the following Git commands:
git clone USERNAME#IPADDRESS:/Media
git clone USERNAME#IPADDRESS:\Media
git clone USERNAME#IPADDRESS:/Media.git
git clone USERNAME#IPADDRESS:/Media/.git
etc
(Not sure what exact command I'm supposed to be running. Do I need .git at the end of this command? I see a hidden .git directory in the Media directory but I don't see a Media.git file.)
I get the following error:
Received disconnect from IPADDRESS: 2: fork failed: Resource temporarily unavailable
fatal: The remote end hung up unexpectedly
Based on my searching I can't tell if this error is coming from my client (Macbook Pro) or server. I read that it could be a threading limit set on my Macbook so I entered the following commands and upped my maxprocperuid:
sudo sysctl -a|grep maxprocperuid (which outputted 709)
sudo sysctl -w kern.maxprocperuid=3000 (upped it to ridiculous number to see if it was the problem)
But I am still getting the error when trying to clone the repository.
If you've gotten to the end of this thanks, just trying to provide as much info as possible and any help would really be appreciated.
Thanks.

Try uninstalling OpenSSH and then installing WinSSHD again. Check out this link which suggests the same.
Also, this question might be of some help to you while you are at it.

Git doesn't use ssh by default so you have to specify it when cloning
git clone ssh://[username]#[ip-address]:[port][/path/to/repo]

Related

Git Bash -Segmentation Fault Problem (Windows)

Indeed I have same issue which is mentioned here "Why does bash (from git installation) give me segmentation fault suddenly?
"
My git was working properly. But I need to regenerate keygen value and I got segmentation fault. I remoted git and installed the latest version of git (2.19.0-64-bit). I tried with git-bash from search, bash.exe from bin folder , git.exe from bin folder , git-bash.exe under Git Folder and git-cmd.exe under Git folder. The results are same.
After I read the link I shared above , I checked the windows updates as well. But there is no update.
Is there any idea ? Thanks in advance
2.9 is not the latest, one: 2.19 is.
Try (for testing) and uncompress the latest Git for Windows portable archive PortableGit-2.19.0-64-bit.7z.exe anywhere you want.
Then setup a simplified path in a CMD session.
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
set GIT_HOME=C:\Path\to\Git
set PATH=%GIT_HOME%;%GIT_HOME%\bin;%GIT_HOME%\usr\bin;%GIT_HOME%\mingw64\bin;%PATH%
(Add any other path you would need)
Try then to regenerate your SSH key.
Also, make sure this is not related to an AV (Anti-Virus) as in issue 1832 or issue 1291.
My company also uses TrendMicro.
Can confirm that making an exception for /Git/usr/bin/bash.exe works as well.
For me it was C:\Program Files\Git\usr\bin, but adding it to the list of trusted programs did indeed fix the issue
I faced the same problem yesterday. Using git-bash, all my commands (i.e. mvn, javac, git pull) were giving error "Segmentation fault". This was because an update of my machine anti-virus which blocks proper access to my local login profile (sambit-swain#TERMINAL) After un-installing it, everything went back to normal.
So, the problem is not with GIT BASH or any other configuration. I should have checked the access levels (including SSH keys) to programs.

Does SSH server need to be running in a unix style environment on remote client for GIT clone to work?

I am tasked to set up a central GIT repo internally for my team.
I'm working on getting this setup on a Windows Server 2012 R2 machine. To the best of my knowledge I've set this up correctly.
I have been following this tutorial but they use CopSSH which isn't free anymore so instead I installed Windows OpenSSH here: Install-Win32-OpenSSH.
On our windows server I've installed and configured the Windows OpenSSH along with GIT. Made the appropriate changes with regards to the environment variables and references needed.
On my local system (also windows) I've installed Putty and generated my public and private keys. The public key has been copied to the server and placed in the correct file. Using putty, I have verified my public/private key authentication is working.
On the server I created a git bare repository in the C: drive like so:
cd C:\
mkdir testing.git
git init --bare testing.git
I installed GIT on my local machine and run the command:
git clone ssh://name#host:port/testing.git
I always end up with the output:
Cloning into 'testing'...
fatal: ''/testing.git'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I've tried different variations of this command with the same results and moving the testing.git file to the user home directory (C:\Users\name):
git clone ssh://name#host:port/c/testing.git
git clone ssh://name#host:port/~/testing.git
I've messed with permissions to explicitly give permissions for this user to access that directory.
It seems as though, maybe the git clone command cannot find the folder on the remote server. I started thinking that the SSH server itself needed to be running in a unix like environment like cygwin. Is this my issue? I've seen tutorials/walkthroughs of installing cygwin with openssh and this would be my next attempt.
Thanks for any help!
EDIT:
So I went ahead and installed Bitvise with their 30 day trial (to try) and everything works but this is only for 30 days. So this must mean that there is some set up issue with the Windows OpenSSH that I have?

How do I unlink my computer from a github account?

I've been able to push with the mac GitHub app to a GitHub repo, but I'm trying to use the command line now and I see this error:
remote: Permission to bfred-it/test.git denied to wildlifela.
wildlifela is a company account that I used recently on a different project, I think I only added my SSH key to that account.
The problem is that even after removing my key from that account (wildlifela), my account (bfred-it), the RSA keys from my computer (with ssh-add -D) and emptying the ~/.ssh folder, I still get that error.
It doesn't seem to be a repo issue: I just created a repo on GitHub.com, cloned it to my desktop, created a commit and git push origin master still produces that error.
After following the Generating SSH Keys procedure, ssh -T git#github.com authenticates me as bfred-it, but I still can't push as bfred-it.
What can I do?
(OSX 10.9)
I worked around this issue by using a different version of git.
Instead of using OS X's git I'm now using homebrew's git and it's working correctly.
If anyone has any insights as to what was happening, please share.
although i removed the ssh keys and the git config files from the OS, it just won't let me clone/pull/push to repositories
Check that the repo is indeed owned by you (for pushing to it)
There always is the option of using https url (with GitHub username/password)
removing the ssh key might not be enough, you also have the ~/.ssh/config file.
As mentioned in the comment, it can depend on your version of Git and on your OS (Windows, Mac or Linux).

Git fails initial push to new repo on network drive

Can you help me understand why my simple startup project is not working? I am using Windows XP, with Git installed from Git-1.8.1.2-preview20130201.exe. I am using Git Bash provided with the installation.
On the networked drive I do the following:
cd /k/repos
mkdir LV_Libraries.git
cd LV_Libraries.git
git init --bare
At my local copy of the project:
git init
git add *
git commit -m "Initial Commit"
git remote add origin /k/repos/LV_Libraries.git
git push origin master
The push fails saying,
"remote: error: unable to write sha1 filename ./objects/pack/pack-b69cd03c4c ... .pak: Permission denied"
"Remote: fatal: cannot store pack file"
"Error: unpack failed: index-pack abnormal exit"
"To k:/repos/LV_Libraries.git
! [remote rejected] master -> master (unpacker error)"
I initially thought it might be a file permissions thing, but I have no problems writing or reading files to the network drive through my terminal. Does anyone have any ideas?
Sounds like you are having problems similar to this question git: can't push (unpacker error) related to permission issues, i.e. permission problems on the k: disk, possibly related to user permissions.
Have you checked the exact permissions that you have on the UNC path for folder on K:?
I encountered this issue when attempting to push changes from a Windows machine via a Samba share hosted on a Mac OS X machine. I resolved this by initializing a SSH server on the Mac OS X machine and then cloning the project again via SSH on the Windows machine. Hence, all subsequent pushes from the Windows machine have worked beautifully without any errors.
When I checked out the project, via the Git GUI for Windows, I used the following syntax for the repository:
ssh://username#machost_ip:full_path_to_project
The username was the username used to create the project, the machost_ip was the IP address of my Mac OS X machine on my LAN, and the full_path_to_project was the fully qualified Unix path to the origin/master Git project.
I did not have success with the continued use of the shared drive even after changing group permissions. Although, I'm sure the username could be that of a user assigned to the group with write privileges to the project as specified in previous answers.
I deleted my git repository and then recreated it with
git init --bare --shared
and this solved the problem for me. Other answers mention setting config for shared and bare, but I found that only recreating the repository helped.
Have are your CRLF settings?
When playing around with the settings, I managed to generate a change that caused an problem identical to yours. In the end, I create a new clone of the remote repo and slowly merged my changes back to it.
I encountered same error yesterday. I am simply trying to clone one Big Git repository to my local windows machine using Git Bash 2.9.2.
After killing significant amount of time and reading above answers. I ran Git Bash as administrator and it worked like a charm. I am able to clone repository. Not sure what is the issue, I guess it is most probably related to permissions as many pointed.

Why doesn't git clone work with bitvise tunnelier on windows?

I am trying to clone a repo to my laptop from my main PC. Both systems use windows 7 (I know, go to linux). They also both have the latest msysgit running.
On the PC I have bitvise server for SSH, and have the client version running on the laptop. Git is setup as an env path in windows, and I can log into the PC from the laptop via SSH (keys have been shared, homepath set etc.)
When I type the following into msysgit on the laptop, I get an error:
git clone username#192.168.1.5:XABC
fatal: ''XABC'' does not appear to be a git repository
now if I type ssh username#192.168.1.5 ls XABC/.git I get the expected
COMMIT_EDITMSG
FETCH_HEAD
HEAD
etc.
What am I doing wrong?
Try cloning the remote repository with this command:
git.exe clone -v "ssh://user#XXX.XXX.XX.XX:YY/path/to/git/repo/repo.git" "C:\path\to\desired\clone"
Where XXX.XXX.XX.XX is the remote IP address and YY is the port, usually 22 for ssh service.
Haven't tried it but it should work.
Also, check this answer and this blog post.
Hope it helps!
I used this combination long time ago.
Try using absolute dir and MSDOS(yes! C:\\FOO\\BAR) dir syntax with BitVise sshd, which does not include a unix-style dir hosting, unlike Cygwin.
I suspect this is a dir presenting issue. So I suggest using pscp.exe from putty, do a successful scp on your .git file and use the url you had luck on.
Anyway git don't care about storage and network, you can clone via windows share, ftp, another dir, and even Dropbox dir...

Resources