Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git clone unable to create file

Tags:

git

git-clone

Trying to clone a remote git repository (bare), I get several errors like the following, after which git stops.

error: unable to create file frozen/email/lamson/mymailserver/run/queue/mark.name/cur/1361115664.1929_1.vps-pool-55:2,S (Invalid argument)

It's okay if I have to remove these files, but I can't find a way to do that if I can't clone.

Any idea what I can do?

like image 772
Mark Avatar asked Jul 28 '13 16:07

Mark


People also ask

How to resolve file name too long issue in git?

Solution. To resolve this issue, we could change the Windows default 260 character limit in the Windows registry or by configuring the core. longpaths workaround in git config.

What is git clean command?

Summary. To recap, git clean is a convenience method for deleting untracked files in a repo's working directory. Untracked files are those that are in the repo's directory but have not yet been added to the repo's index with git add .

What happens when you git clone?

The Git clone command will create a new local directory for the repository, copy all the contents of the specified repository, create the remote tracked branches, and checkout an initial branch locally. By default, Git clone will create a reference to the remote repository called origin .


2 Answers

I guess you're probably trying to do the clone on a Windows machine. Windows doesn't allow filenames to use the : character.

From the Microsoft documentation:

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:

  • The following reserved characters:
    • < (less than)
    • > (greater than)
    • : (colon)
    • " (double quote)
    • / (forward slash)
    • \ (backslash)
    • | (vertical bar or pipe)
    • ? (question mark)
    • * (asterisk)
  • Integer value zero, sometimes referred to as the ASCII NUL character.
  • Characters whose integer representations are in the range from 1 through 31, except for alternate data streams where these characters are allowed. For more information about file streams, see File Streams.
  • Any other character that the target file system does not allow.

To work around this problem, you will probably need to clone on a non-windows system and correct the offending filenames. Maybe some of the windows experts out there will have a better solution.

like image 124
Carl Norum Avatar answered Oct 14 '22 19:10

Carl Norum


I'm cross-referencing my answer, as it also applies here: https://stackoverflow.com/a/34515900/1012586

Yet instead of

*
!kickstarter/parsers/data/kickstarter/campaigndetails/*

you'd need something like

*
!frozen/email/lamson/mymailserver/run/queue/mark.name/cur/*

in your .git/info/sparse-checkout

like image 3
Morty Avatar answered Oct 14 '22 17:10

Morty