Git push to LAN repo stalls or stops without error - windows

Intent
I intend to establish a version control service in a windows local network.
Test Environment
I have a /root folder where there are 2 repos /foo and /bar
Attempts
I was advised to use a git-daemon service (http://git-scm.com/docs/git-daemon) but it's been more complicated to implement (and works differently) from advertised.
The first guide i found was http://railsware.com/blog/2013/09/19/taming-the-git-daemon-to-quickly-share-git-repository/. I used their git daemon options in the '/root' folder that would serve all repos contained therein:
$ git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose
I was succesful in cloning an empty repo but when I added some content this the message i got:
$ git clone git://root-ip-addr/bar
Cloning into 'bar'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
fatal: read error: Invalid argument
Receiving objects: 100% (3/3), done.
fatal: error in sideband demultiplexer
Next i found http://www.gitguys.com/topics/creating-a-shared-repository-users-sharing-the-repository/ where they don't even mention the daemon but instead went for a local-folder-as-remote aproach. I still think I need a daemon so what I tried was making my repos bare while adding the -enable:receive-pack option on the daemon.
They advise to use branches on the client machines to commit so I did. I also committed to the master branch to see what happens. In both cases GIT seems to stall.
Here is a screenshot of the client machine attempting to push to the central hub. You can see that it stalls at that point.
Here is a screenshot of the central hub running the daemon.
I can only key in ctrl+c to stop the git daemon altogether after that.
The only way that I've actually gotten it to work was calling the daemon from inside the repo, but that would entail having to do that for every repo (i intend to establish this for hundreds of repos)
I understand that I should dedicate a couple of weeks to thoroughly understanding Git, something that I've postponed for the past 6 months, since I've been able to get by with basic clones, adds and commits.
Having said that, i think there should be more visually constructive guides when attempting to explain the git workflow metaphor.
Thank you for your time.

It seems that it is related to bug #101 (issue 457 on google code) in msysgit and a fix was introduced in Git-1.9.4-preview20140611.
Setting the sendpack.sideband config option and than push again works.
git config --global sendpack.sideband false
git push origin ...
I tried it with this git daemon command
git daemon --base-path=. --export-all --reuseaddr --informative-errors \
--verbose --enable=receive-pack

Related

git push in WSL2 environment hang up during Writing Objects step

Symptoms
I have a git workspace in WSL2 environment. The workspace is located under /mnt/c/workspace/repo where is also visible from Windows by the path C:\workspace\repo.
When I do git push from WSL2 side in the workspace, Git hang up with this message.
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 16 threads
Compressing objects: 100% (24/24), done.
Writing objects: 34% (9/26)
This is the other observed behavior and environment information in this context.
I can push these files from Windows side with git for windows without any problems.
I can push several times just after cloning files. It won't work after some of my push operations.
This repository just contains text files. The entire repository size is less than 1MB
I've used this environment for several months but I observed this issue just only for this repository
This problem also happened when I copied entire folder to ~/workspace/repo where is not exposed to Windows directly.
The remote is configured to connect with SSH and use the key under /home/<username>/.ssh
Environment information
Linux image in WSL: 20.04.2 LTS (Focal Fossa)
Git version: 2.25.1
Windows version: Microsoft Windows [Version 10.0.19042.844]
$ git config --global --list
user.email=<my mail address>
user.name=<my name>
http.postbuffer=524288000
Tried workarounds
Configureing http.postBuffer
git config --global http.postBuffer 524288000
I've followed this answer in different question in stackoverflow.
https://stackoverflow.com/a/26663047/3200358
This workaround won't work for me.
Windows permission change attrib -r +s
I've followed this workaround to fix some permission problem in Windows side.
https://stackoverflow.com/a/63483040/3200358
attrib -r +s C:\workspace\repo
This workaround won't work for me.
Tried sudo git push
I've tried sudo git push for in case when git command can't access some lock files.
sudo GIT_SSH_COMMAND='ssh -i /home/<username>/.ssh/id_rsa' git push origin master
This workaround won't work for me.
Using https to push
The error message was changed. But this workaround won't work for me.
$ git push --set-upstream origin master -vvvv
Pushing to https://github.com/kyasbal-1994/<repo-name>.git
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 16 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 5.53 MiB | 7.42 MiB/s, done.
Total 26 (delta 6), reused 0 (delta 0)
POST git-receive-pack (5802813 bytes)
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
Have you tried invoking Windows' git from WSL by using the path to the Windows git.exe? In fact you could set up an alias in your .bashrc:
alias wgit='/mnt/c/path\ to\ git/Git/git.exe`
This way, you have a Windows executable dealing with Windows files instead of a Linux executable dealing with Windows files, though I'm a little fuzzy on how things work with the mounting.
However, I'm not sure how user-friendly this may be when entering paths.
Assuming that works, there's probably even a way to write a smart wrapper function in bash that detects which file system the repo is on and invokes the right git executable...
As an alternative, you may have more luck maintaining 2 separate repos (WSL & Windows) and then syncing via push/pulls from a server.

Git clone a little bit at a time or other solutions

I'm working on a Windows machine, from git bash.
We recently moved our project from a TFS server to a git repo on the same server. As far as I know, this was all done in one commit. I am remote.
When I run git clone <url> the clone will start, but at some seemingly arbitrary point (a different one every time), it will fail with:
error: RPC failed; curl 56 Recv failure: Connection was reset
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
I was thinking perhaps if there were a way to clone the repo a few files at a time, that would work. It seems unlikely that such a solution exists. I have tried increasing the http.postBuffer to 157286400, and I do not think switching to ssh is an option for us currently. A shallow clone is unhelpful, as there has only been one commit. These are the solutions I've seen elsewhere. Any help would be greatly appreciated.

git clone error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054

I'm having trouble cloning a repo on git. I've been trying for to days and have tried quite a few solutions (in most the problem was slightly different but seemed to apply) but nothing has done anything to make a difference.
I've tried switching off the anti-virus and firewall but that didn't help.
I've also tried uninstalling and reinstalling the network adapter drivers (and restarting the computer) and that didn't work.
From what I understand it's a network issue somewhere as the remote server keeps hanging up but I'm not managing to get anywhere with the issue.
Using git clone -v --progress seemed to give the same output as git clone.
Output from git clone -v --progress https://github.com/mit-cml/appinventor-sources.git
Cloning into 'appinventor-sources'...
POST git-upload-pack (gzip 1425 to 774 bytes)
remote: Counting objects: 41649, done.
remote: Compressing objects: 100% (7/7), done.
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
I've now tried increasing the buffer again
git config --global http.postBuffer 1048576000
but still nothing.
I'm following the solution from The remote end hung up unexpectedly while git cloning for troubleshooting.
I resolved the same problem by this:
git config http.postBuffer 524288000
It might be because of the large size of repository and default buffer size of git so by doing above(on git bash), git buffer size will get increase.
I had the same issue, and I have solved it by changing my net connection.
In fact, my last internet connection was too slow (45 kbit/s).
So you should try again with a faster net connection.
I had the same problem, and #ingyhere 's answer solved my problem .
follow his instructions told in his answer here.
git config --global core.compression 0
git clone --depth 1 <repo_URI>
# cd to your newly created directory
git fetch --unshallow
git pull --all
you need to increase the buffer size (it's due to the large repository size),
so you have to increase it
git config http.postBuffer 524288000
Althought you must have an initializd repository, just porceed as the following
git init
git config http.postBuffer 524288000
git remote add origin <REPO URL>
git pull origin master
...
git config --global http.postBuffer 524288000
Work in my case - AWS code commit
This happens when you push first time without net connection or poor net connection.But when you try again using good connection 2,3 times problem will be solved.
I have tried "git init" and it worked like charm for me.
I got it from the link Git push error: RPC failed; result=56, HTTP code = 200 fatal: The remote end hung up unexpectedly fatal
(based on anser from Hakan Fıstık)
You can also set the postBuffer globally, which might be necessary, if you haven't checkout out the repository yet!
git config http.postBuffer 524288000
Uninstalling(version: 2.19.2) and installing(version: 2.21.0) git client fixed the issue for me.
just Disable the Firewall and start again. it worked for me
It could be an issue with your network (i.e. not an issue with any of your git configs, firewall, or any other machine settings). To confirm this, you could test the following:
See if this issue persists on the same network on different machines (this was true for me).
Try running the problematic git command (for me it was git pull) on a different network and see if it works. I brought my desktop over to a friend's and confirmed that the command did indeed work without any modifications. I also tested the command from my laptop on an open network nearby and the command also started suddenly working (so this was also true for me)
If you can confirm #1 and #2 above, it may be time to schedule an appointment with a technician from your ISP. I have fiber internet in a fairly newish building and when the technician arrived they went to my building's telecom room and switched my internet port. That somehow seemed to fix the issue. He also let me know that there were other issues at large going on in my building (so it could have nothing to do with your machine or things in your control!).
If that fails, maybe consider switching internet providers if that's an option for you. Else, just keep calling your ISP to send in more and more senior technicians until it gets resolved.
I'm hoping nobody actually has to resort to what I did to find the problem.
tl;dr: Give your ISP a call as the issue could be one with your network.
All these tips did not work for me,
what worked was cloning over ssh rather than http
Following steps helped me to fix this issue,
Solution 1:
git checkout master
git pull
git checkout [you current branch]
git pull
You can also set git config http.postBuffer 524288000 to increase the network buffer
Solution 2:
Sometimes it happens when you are cloning your repo using VPN and it fails to verify the SSL
Try this out it may help:
git config http.sslVerify "false"
I had the same issue and found out the problem was with my internet speed, after getting on a better connection the problem was solved solved.
Before cloning just run "git init". It will create local .git and it will allow for clone.
If you have VPN opened, close and try it again.
It's mentioned as SSL_ERROR_SYSCALL, errno 10054.
To resolve this SSL issue I went to .gitconfig file (which is located in c drive in my desktop) I changed sslverify to false and added my username and email id.
sslVerify = `false` //make sslVerify as false
[user]
name = `***<Enter your name>**`
email = `**<Email Id>**`
I had the exact same problem while trying to setup a Gitlab pipeline executed by a Docker runner installed on a Raspberry Pi 4
Using nload to follow bandwidth usage within Docker runner container while pipeline was cloning the repo i saw the network usage dropped down to a few bytes per seconds..
After a some deeper investigations i figured out that the Raspberry temperature was too high and the network card start to dysfunction above 50° Celsius.
Adding a fan to my Raspberry solved the issue.
What I did is moved the dependencies list to the end of
#Pods for <app>
In Podfile. Like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target '<app>' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for <app>
target '<app>Tests' do
inherit! :search_paths
# Pods for testing
end
target '<app>UITests' do
inherit! :search_paths
# Pods for testing
end
pod 'Firebase/Core'
pod 'Firebase/Database'
end
In my case, its something wrong with my DNS server, after i add a new github.com record in the hosts, the problem solved.
13.114.40.48 github.com
1. Go to https://gitforwindows.org
2. Download
3. Install (no need to uninstall)
4. That's it! No more error: RPC failed; curl 56 OpenSSL SSL_read: No error
I too have faced this issue today. I have tried all the options shared in this thread but I was still having the issue.
I tried cloning after connecting to my corporate VPN and cloning got completed successfully. So, guys it might have to do with your local firewall policy. Factor in that as well :)
This is what works for me.
git config --global http.sslVerify "false"
For me, git config --global http.postBuffer 524288000 alone did not fix it, I had to run git config --global core.compression 0 as well.
this issue is resolved by cloning using SSH key.
first of all set the ssh key and then add it to your git/github account. and then try to clone using ssh instead of using http.
in my case this solved my problem.
i tried all the other solution including increasing the buffer size, changing the git version, etc.
none of these solution works in my case.
I've tried postBuffer, core.compression and --depth 1, nothing is working perfectly, I mean sometimes, I could clone but most of the time, I got the same error. For me, it got worked out by cloning using SSH url. You can follow below steps to clone in ssh way
create ssh key
create .ssh folder in your user directory (C:\Users\Rence Abishek\) and inside .ssh folder, create a file named id_rsa
Open your terminal from user dir and execute below commands to create ssh private and public key
ssh-keygen -t rsa -b 4096 -C "renceabishek#abc.com"
press y to override existing file i.e id_rsa and not require to give passphrase, just hit enter
eval $(ssh-agent -s)
ssh-add ./.ssh/id_rsa
copy ssh key to your git version control(gitlab,bitbucket,github..etc)
Execute cat ./.ssh/id_rsa.pub command in terminal to get public key in console, now copy that and go to your GIT version control setting and add your copied public key.
Github -> click on your profile(top right cornor) -> setting -> SSH and GPG Keys -> New SSH Key button
clone repo
Now clone using ssh url git clone YOUR_SSH_URL
try this,
git init first/reinitialize
then, global http.postBuffer 157286400
after that, just set/add ur remote like before
add, commit, push. this solves mine
For me the issue was with my wifi extender. When I connect directly to my wifi without using extender, it started working.

Using a network drive as git repository

So, I've created a git repository on the networked drive:
git init --bare --shared
and that works fine. Then, I clone it to a local drive with
git clone z:/testgit
and that also works fine. Then I add a file, stage, and commit
git stage *
git commit -m "test commit"
and that ALSO works fine. BUT! When I try to push to the origin, I get this error.
git push origin
Counting objects: 3, done.
Writing objects: 100% (3/3), 225 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: unable to write sha1 filename ./objects/f3/e6e90a7465421306fae05c18153260973542e3: Permission denied
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To z:/testgit14
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'z:/testgit'
When attempting to use git stage * directly on the server (on a non --bare git project) I get similar errors.
I have full access to the drive in file explorer, and even able to initialize the repository with git. SSH shouldn't even apply here since it's not a server, it's a networked drive. Everything I've read about git says that this should work. I've read dozens of "how to's" that all say these exact steps, but no one complaining about permission denied, UNLESS they're talking about SSH public keys missing on servers (which, as I've said, shouldn't apply).
What permissions am I missing? Where should I look for and set the proper permissions?
What happens when you try to create the file that git is complaining about?
echo test > ./objects/f3/e6e90a7465421306fae05c18153260973542e3
It's possible that git is creating a new folder (f3) and the folder is not getting the correct permissions, either due to ACL inheritance misconfiguration or because the local machine is trying to adjust the permissions on newly created folders and getting it wrong.
If it were Linux, it could be because the network drive was connected with the wrong mount options, or the umask was set incorrectly, but I'm not sure whether those are available to be changed on a Windows machine.

Why do I sometimes get mergeconflicts on pulling but trying again works?

I created a new file in a local folder monitored by git. I then did
git add .
git commit -m "blah blah"
git push
but was rejected with
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I tried git pull and got the error
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
which is a bit surprising considering there is only the master branch.
So I tried git pull origin master and something looking like VI with a bunch of empty lines opened up wanting me to resolve merge conflicts and it didn't give any information.
I just want to push changes to the repo. I'm the only one working on this personal project. I'm using Windows 10 and the official git bash. How do I git over this problem?
BUT WAIT!
I tried git pull origin master a second time and it worked! Nothing had been changed. This has happened before and I'd like to know why?
Here's the details:
first git pull origin master gave
* branch master -> FETCH_HEAD
second:
branch master -> FETCH_HEAD
Already up-to-date.
third:
remote: Resolving deltas: 100% (2/2), completed with 1 local objects.
no other commands were run in between. On the first one a bizarre VIM text editor opened up that wanted me to type something in.
remote: Resolving deltas: 100% (2/2), completed with 1 local objects.

Resources