Git fetch github: Index-pack failed - windows

When running the command git fetch github , I get the following error:
fatal: write error: Broken pipe93), 23.23 MiB | 635 KiB/s
fatal: index-pack failed.
I then get a "git.exe has stopped working" error message while Windows attempts to find a solution to the problem.
Running *GIT_TRACE=1 git fetch github* doesn't give any additional details.
Note: I can perform a git fetch github [branch name] directly and that works without error
When I try "Repository > Compress Database" in Git Gui, I get "Error: Command Failed". I get the same error when I try "Repository > Verify Database".
How do I get around this? It's almost like my local repo is corrupt.
System Info
*Git Bash: 1.7.4-preview20110204
Windows 7 64-bit*

Couple of options:
check if the problem persists in a new local repo (so, after re-cloning your GitHub repo)
check if raising the postBuffer size can alleviate the problem
git config --global http.postBuffer 524288000
(as mentioned in "The remote end hung up unexpectedly while git cloning")

Related

Ansible: git clone fails with "fatal: Out of memory, realloc failed"

I'm using Ansible with a Windows host (VM).
I'm trying to git clone a large content (actually using git lfs). It's around 15Go in total
I'm using git for windows (https://github.com/git-for-windows/git/releases/tag/v2.37.2.windows.2).
I have the following Ansible task:
- name: Clone repository
ansible.windows.win_command: >
<path/to/git.exe> clone <git-repo>
The problem is that it always fails with the error:
fatal: Out of memory, realloc failed
I tried to increase the windows VM memory, or to play with git config settings, as explained in several posts, for example:
remote: fatal: Out of memory, realloc failed on git push with post-receive hook
git out of memory on checkout
https://community.atlassian.com/t5/Bitbucket-questions/Message-erro-quot-fatal-Out-of-memory-realloc-failed-quot/qaq-p/894048
But none of these solutions work for me. It always failed at the same points:
"Filtering content: 48% (440/902), 2.11 GiB | 6.70 MiB/s",
"fatal: Out of memory, realloc failed",
"Error downloading object: xxxxxxx: Smudge error: Error reading from media file: write /dev/stdout: The pipe is being closed.: write /dev/stdout: The pipe is being closed.",
"",
"Errors logged to 'xxxx.log'.",
"Use `git lfs logs last` to view the log.",
"warning: Clone succeeded, but checkout failed.",
"You can inspect what was checked out with 'git status'",
"and retry with 'git restore --source=HEAD :/'"
The weird things is that this error only happen using Ansible. If I connect to the VM and manually run exactly the same git clone command, everything goes well.
Do you have any idea to help me? Thanks
I experienced the same behaviour in a similar situation. I was trying to do a reference clone for a repository that's originally over 100GB and also contains LFS files. The out of memory was only seen when trying to execute the clone via Ansible's win_shell.
What worked for me was using the Ansible win_shell module and increasing the MaxMemoryPerShellMB to a large enough value. I figured out the value by doubling the memory until it was larger than the default value but smaller or equal to the actual memory limits of my machine.
Including a snippet of what tasks you'll need to resolve this problem successfully:
---
- name: Increase MaxMemoryPerShellMB
win_shell: 'Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB <value>'
- name: Clone the repository
win_shell: '<git clone command>'
args:
executable: cmd
Additionally, if it's possible for your usecase, I'd recommend skipping the clone of LFS files and fetching the files that you need afterwards. Refer to the git config commands in 'How to clone/pull a git repository, ignoring LFS?'. It's subtle but the answer seems to indicate that GIT_LFS_SKIP_SMUDGE variable is obsolete for Windows. I'm still trying to find a proper piece of documentation for this.
I hope this helps you!

Git push error: the remote end hung up unexpectedly [duplicate]

This question already has answers here:
Git, fatal: The remote end hung up unexpectedly
(49 answers)
Closed 1 year ago.
I pushed two commit changes, then it turned out I had to pull some changes that a coworker made. When I try to push I get this error:
>>> /usr/bin/git push origin HEAD:refs/heads/main
error: RPC failed; curl 55 Failed sending data to the peer
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
Solutions I've tried without success:
git config --global http.postBuffer 524288000
git config --global http.version HTTP/1.1
try to do this
delete .git/ from your project
clone the remote repo to some new location like your desktop:
3.git clone https://github.com/foo/bar.git
4.move .git/ from the new location into the old location
re-commit and push your changes

RPC failed; curl 56 SSLRead() return error -9806 MiB/s

I am trying to install my cocoa pods.
After doing everything and installing it i got the error :
[!] Unable to add a source with url git#github.com:CocoaPods/Specs.git named master-1
And to fix that error I tried:
cd ~/.cocoapods/repos
git clone https://github.com/CocoaPods/Specs.git master
Then I get this error which I don't know how to deal with:
remote: Counting objects: 854549, done.
remote: Compressing objects: 100% (3453/3453), done.
error: RPC failed; curl 56 SSLRead() return error -9806 MiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
The git clone is indeed what issue 4293 recommends.
But if the clone fails with a "RPC failed; result=56" error message, check your git buffer:
git config --global http.postBuffer 2M
Then try again your git clone.
If not, investigate with:
GIT_CURL_VERBOSE=1 git clone https://github.com/CocoaPods/Specs.git
Finally, if https does not want to cooperate, try the ssh url:
cd ~/.cocoapods/repos
git clone git#github.com:CocoaPods/Specs.git
Continuously try 3 times pod setup first and second time it fails. third time it works. Even if the third time fails run again it and continuously open a webpage or stream online videos, this will works. i have tested two times, one in 10.12sieraa
I got the same error message. In my case I resolved it by changing to http.
git clone https://github.com/CocoaPods/Specs.git master

error: cannot open .git/FETCH_HEAD: Invalid argument

I'm using Git (from the GitHub for Windows distro) and trying to pull from my repo and I get the following error:
D:\Code\dopey-weaver [master]> git fetch
error: cannot open .git/FETCH_HEAD: Invalid argument
D:\Code\dopey-weaver [master]> git fetch --verbose
error: cannot open .git/FETCH_HEAD: Invalid argument
This isn't the "Permission denied" of many other questions, so it seems like I'm a special snowflake... I can open .git/FETCH_HEAD and it looks fine(?):
010779f14f5bdf1d2d806a0ce0ac4c5e50314186 branch 'master' of https://github.com/nicktimko/dopey-weaver
I think I have some conflict with what's on the remote so I should be pulling/merging, but I can't even fetch to start... The error message on push does look a little long (is this the equivalent of hg saying "this would create multiple heads" in not so many words?)
D:\Code\dopey-weaver [master]> git push
To https://github.com/nicktimko/dopey-weaver.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/nicktimko/dopey-weaver.git'
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.
The problem appeared to be because the volume (an exFAT drive) was dirty, thus read-only, and needed to be run through chkdsk. So, to solve:
Launch PowerShell/CMD in elevated mode (easy way being to right-click on the short-cut in the Start menu and pick "Run as administrator")
Run chkdsk on the desired volume, e.g. chkdsk D: /X (/X forces a dismount)
If you're having this problem on the primary partition (C:), you'll probably have to do chkdsk at startup...somehow.

Git remote server Push fails

After cloning a Git repo from my remote server, I have committed some changes on my local copy. I'd like to push these changes back to the remote server, but I'm getting an error message that yields no useful information:
fatal: read error: Invalid argument
(Ps. both the server and the local repo are running in Windows environments)
I have tried:
git push
git push origin
git push origin master
A push through the GUI version of GIT yields the same useful error message.
EDIT
After setting the Environment variable GIT_TRACE=1, I get slightly more output:
C:\repo>git push --verbose
setup: git_dir: .git
setup: worktree: C:/repo
setup: cwd: C:/repo
setup: prefix: (null)
trace: built-in: git 'push' '--verbose'
Pushing to git://MYSERVER.MYCOMPANY.net/repo
fatal: read error: Invalid argument
Any thoughts?
Looks like you're running in a plain cmd.exe terminal instead of msysgit's bash terminal. Much of git relies on shell scripts; thus, you need to run in a bash terminal instead of cmd.exe.
Are you sure the server is configured correctly, has your SSH key, etc? Did you home-brew the Git server or is this something like git-hub / assembla ?

Resources