Git (Windows) - cannot create file on clone. Works as Superuser - windows

I'm using Windows 8, 64bit - I recently installed Git to use it on this computer. However, it is not possible to clone any repository. It exits with the message:
$ git clone ssh://me#some.address.com/some/git/repository.git
Cloning into 'repository'...
error: Unable to create c:/Users/Danyel/workspace/repository/.git/HEAD
When I open cmd as Administrator and try the same command, it succeeds (cmd as normal user fails just like with Git Bash):
C:\Users\Danyel\workspace>git clone ssh://me#some.address.com/some/git/repository.git
Cloning into 'repository'...
remote: Counting objects: 221, done.
remote: Compressing objects: 100% (195/195), done.
remote: Total 221 (delta 34), reused 167 (delta 15)
Receiving objects: 100% (221/221), 9.23 MiB | 1.38 MiB/s, done.
Resolving deltas: 100% (34/34), done.
Checking connectivity... done
I'm using this version of Git: Git-1.8.4-preview20130916
Any help or clues are welcome! I have checked for the permissions and have ownership in parent folders ("repository", ".git"). What else can it be??
Edit:
The GIT_TRACE option did not give any clue about it either:
$ GIT_TRACE=2 git clone ssh://me#some.address.com/some/git/repository.git
trace: built-in: git 'clone' 'ssh://me#some.address.com/some/git/repository.git'
Cloning into 'repository'...
error: Unable to create c:/Users/Danyel/Desktop/repository/.git/HEAD

As illustrated in this thread, that kind of error message only happens when one of the parent folders is a symlink.
Check if you can clone it in another path (C:\ or C:/Users/Danyel).
But I suspect that Desktop\workspace is a symlink, and as such, not very compatible with a cloned repo path (because that would un-symlink that path, which might not be compatible with other apps/process using that same path).
The only other instance of that issue is related to a path-length limit.

Related

pack has bad object at offset 152904485

I'm trying to clone a repository on Gitlab with the command:
git clone git#gitlab.com:company/folder/project.git
And every time I get this output:
remote: Enumerating objects: 3860, done.
remote: Counting objects: 100% (482/482), done.
remote: Compressing objects: 100% (360/360), done.
fatal: pack has bad object at offset 152904485: inflate returned 1
fatal: fetch-pack: invalid index-pack output
The thing is, it happens only on my machine, I tested the exact same command accessing a linux machine remotely through ssh and it works just fine. Also, it's relevant to mention that I'm using git on Windows 11. How can I solve this?
As in this thread, start checking the protocol used:
git -c protocol.version=1 git#gitlab.com:company/folder/project.git
As bit as in this gist, you could try an incremental clone, using a shallow clone (--depth)
REPO=$1
DIR=$2
git clone --recurse-submodules $REPO $DIR --depth=1
cd $DIR
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --depth=10
git fetch --depth=100
...
Another approach, clone up to the problematic commit: (--shallow-exclude=<revision>)
git clone --shallow-exclude=anOlCommit
There is a patch in progress around index-pack (June 2022), about unpacking large object in a stream.
The OP Otávio Augusto Silva confirms in the comments:
It didn't worked on Windows 11 cmd but it worked on WSL2 (Ubuntu)
And since Git can be installed on Windows AND on WSL, that could be a valid workaround.

error: waitpid for fetch-pack failed: No child processes

I am getting this error when trying to clone any repository.
cant find much help on this from google.
C:\wamp64\www>git clone https://github.com/codeg8/laravel-crud-generator.git
Cloning into 'laravel-crud-generator'...
remote: Counting objects: 50, done.
remote: Total 50 (delta 0), reused 0 (delta 0), pack-reused 50
Unpacking objects: 100% (50/50), done.
error: waitpid for fetch-pack failed: No child processes
Try running Git application as an Administrator (right click-> Run as Administrator), if its Windows.
It worked for me.
Run the Git Bash as admin and clone the directly.
I had the same issue and above solution worked for me.
This was a problem with the version of Git Installed on my system. I was using an older version of Git.
If anyone is facing the same issue, try upgrading your git installation to latest version. This solved my issue.

Can't clone repository with git on windows

I try to checkout repository on Windows 7 machine with git.exe:
C:/tmp>git --version
git version 2.12.0.windows.1
C:/tmp>git clone https://someuser#bitbucket.org/somcomp/someproj.git
Cloning into 'somproj'...
remote: Counting objects: 11762, done.
remote: Compressing objects: 100% (7028/7028), done.
Receiving objects: 100% (11762/11762), 48.36 MiB | 1.30 MiB/s, done.
remote: Total 11762 (delta 5706), reused 10135 (delta 4230)
Resolving deltas: 100% (5706/5706), done.
fatal: cannot create directory at 'someproj/node_modules/console-stamp/node_modules/dateformat/node_modules/meow/node_modules/normalize-package-data/node_modules/validate-npm-package-license/node_modules/spdx-correct/node_modules': No such file or directory
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
C:\tmp>git status
fatal: Not a git repository (or any of the parent directories): .git
What can I do here? I tried git config --system core.longpaths true advice, but it doesn't help. Any other recipes? Failed folder doesn't seem to contain any ugly characters if I look at it in bitbucket and has only one child folder:
node_modules / console-stamp / node_modules / dateformat / node_modules / meow / node_modules / normalize-package-data / node_modules / validate-npm-package-license / node_modules / spdx-correct / node_modules / spdx-license-ids /
Thanx for any ideas.
Upgrading to git version 2.12.2.windows.2 solved the problem for me, since this bug was fixed only recently.

Middleman asks if I want to use compass when starting a new project

I'm on a Windows 10 machine. I have Ruby installed through git bash. I also have middleman installed (v4.0.0). When I do middleman init "name_of_project" it asks me if I want to use compass and I get stuck.
$ middleman init newproject
run git clone --depth 1 git://github.com/middleman/middleman-templates-default.git C:/Users/dedvv/AppData/Local/Temp/d20160130-11408-c7ch9s from "."
Cloning into 'C:/Users/dedvv/AppData/Local/Temp/d20160130-11408-c7ch9s'...
remote: Counting objects: 22, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 22 (delta 0), reused 14 (delta 0), pack-reused 0
Receiving objects: 100% (22/22), 6.07 KiB | 0 bytes/s, done.
Checking connectivity... done.
exist
create .gitignore
create Gemfile
create config.rb
create source/images/middleman-logo.svg
create source/index.html.erb
create source/javascripts/all.js
create source/layouts/layout.erb
create source/stylesheets/_normalize.scss
create source/stylesheets/site.css.scss
Do you want to use Compass?
I have no idea what to do here in order to move on. y/n yes/no + Enter do nothing. CtrlC just exits. I also did gem install compass to see if it would autoload it and not ask me anymore, but it didn't work.
This issue is only faced on Git Bash windows that uses mingw64, trying the same on Windows Command Prompt (cmd) works perfectly

When cloning git repo under Windows I get "error: unable to create file <file>... (Is a directory)"

Z:\>git clone git://github.com/kennethreitz/httpbin.git
Cloning into 'httpbin'...
remote: Counting objects: 1073, done.
remote: Compressing objects: 100% (401/401), done.
remote: Total 1073 (delta 672), reused 1045 (delta 651)
Receiving objects: 100% (1073/1073), 114.42 KiB | 128 KiB/s, done.
Resolving deltas: 100% (672/672), done.
error: unable to create file httpbin/templates/... (Is a directory)
git version 1.8.0.msysgit.0, Windows Vista SP2 x64
What's wrong?
I think the trouble is this file here in you repo: https://github.com/kennethreitz/httpbin/blob/master/httpbin/templates/...
... is not a valid filename under windows
In order to get the repo, clone without checking out files (with -n flag):
git clone -n git://repo
Then you could use a sparse-checkout to get all file but ..., or you could only git checkout file you actually need.

Resources