threads / discuss / 27627

Copying Git repository from Linux to Windows.

Subject: Copying Git repository from Linux to Windows.

## tl;dr

17 messages between Jun 15, 2011 and Jun 20, 2011.

replies: 16people: 7as markdown or json

viresh kumar· Jun 15, 2011, 09:28 UTC · lore
Hello,

I wanted to copy my complete Linux GIT repo from Linux PC to Windows. I also wanted everything related to remote branches too, so need to copy and clone and fetch wouldn't work.

I don't have windows on same network, so i need to copy to memory stick and then to Windows PC.
After completing copy operation on mem stick, i found something strange.
- git branch shows correct results and is exactly same of state at Linux machine.
- git log is also fine.
- git status, shows me a lot of files are modified, which is not present in Linux.
- git reset --hard also doesn't work and fails with following error.

$ git reset --hard HEAD error: unable to create symlink arch/microblaze/boot/dts/system.dts (Operation not permitted) Checking out files: 100% (36696/36696), done. fatal: Could not reset index file to revision 'HEAD'.

Any help about this issue would be very helpful.
-- 
viresh
Andreas Ericsson· Jun 15, 2011, 09:47 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

On 06/15/2011 11:28 AM, viresh kumar wrote:
Show 22 quoted lines
> Hello,
> 
> I wanted to copy my complete Linux GIT repo from Linux PC to Windows. I also wanted everything
> related to remote branches too, so need to copy and clone and fetch wouldn't work.
> 
> I don't have windows on same network, so i need to copy to memory stick and then to Windows PC.
> 
> After completing copy operation on mem stick, i found something strange.
> - git branch shows correct results and is exactly same of state at Linux machine.
> - git log is also fine.
> - git status, shows me a lot of files are modified, which is not present in Linux.
> - git reset --hard also doesn't work and fails with following error.
> 
> 
> $ git reset --hard HEAD
> error: unable to create symlink arch/microblaze/boot/dts/system.dts (Operation not permitted)
> Checking out files: 100% (36696/36696), done.
> fatal: Could not reset index file to revision 'HEAD'.
> 
> 
> Any help about this issue would be very helpful.
> 

The Linux kernel repository isn't very good to work with on Windows machines, or anywhere where the filesystem is either case-insensitive or case-agnostic.

One reason is that it contains symlink. The other is that there are files sharing the same name and only differ in case.

I suppose the main thought behind it is that Linux kernel hackers almost exclusively use Linux (which has sane filesystems) to do their work, so it hasn't been rectified in the 5 or so years it has been a known (non-)problem.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Jakub Narebski· Jun 15, 2011, 10:40 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

viresh kumar <viresh.kumar@st.com> writes:
Show 9 quoted lines
> I wanted to copy my complete Linux GIT repo from Linux PC to Windows. I also wanted everything
> related to remote branches too, so need to copy and clone and fetch wouldn't work.
> 
> I don't have windows on same network, so i need to copy to memory stick and then to Windows PC.
> 
> After completing copy operation on mem stick, i found something strange.
> - git branch shows correct results and is exactly same of state at Linux machine.
> - git log is also fine.
> - git status, shows me a lot of files are modified, which is not present in Linux.

That is probably because stat information is stale... or stat information doesn't work. Does second "git status" still show files as modified?

Show 7 quoted lines
> - git reset --hard also doesn't work and fails with following error.
> 
> 
> $ git reset --hard HEAD
> error: unable to create symlink arch/microblaze/boot/dts/system.dts (Operation not permitted)
> Checking out files: 100% (36696/36696), done.
> fatal: Could not reset index file to revision 'HEAD'.
Try setting `core.symlinks` to false, or just try
 $ git -c core.symlinks=false reset --hard HEAD
Notice that your repository includes symlinks.
BTW. what filesystem do you use?
-- 
Jakub Narebski
Poland
ShadeHawk on #git
viresh kumar· Jun 15, 2011, 11:04 UTC · re: Jakub Narebski · lore

Re: Copying Git repository from Linux to Windows.

On 06/15/2011 04:10 PM, Jakub Narebski wrote:
Show 10 quoted lines
> viresh kumar <viresh.kumar@st.com> writes:
>> After completing copy operation on mem stick, i found something strange.
>> - git branch shows correct results and is exactly same of state at Linux machine.
>> - git log is also fine.
>> - git status, shows me a lot of files are modified, which is not present in Linux.
> 
> That is probably because stat information is stale... or stat
> information doesn't work.  Does second "git status" still show files
> as modified?
> 
Yes. The files status is same.
Show 16 quoted lines
>> - git reset --hard also doesn't work and fails with following error.
>>
>> $ git reset --hard HEAD
>> error: unable to create symlink arch/microblaze/boot/dts/system.dts (Operation not permitted)
>> Checking out files: 100% (36696/36696), done.
>> fatal: Could not reset index file to revision 'HEAD'.
> 
> Try setting `core.symlinks` to false, or just try
> 
>  $ git -c core.symlinks=false reset --hard HEAD
> 
> Notice that your repository includes symlinks.
> 
> 
> BTW. what filesystem do you use?
> 

It was FAT on memory stick as FAT is also there in Windows PC. More observation: All files marked modified had only changes in file permissions. i.e. 755 instead of 644. chmod doesn't work with FAT so can't change there permissions now.

Problem is not only for symlinks but standard c files too.
-- 
viresh
Erik Faye-Lund· Jun 15, 2011, 11:26 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

On Wed, Jun 15, 2011 at 1:04 PM, viresh kumar <viresh.kumar@st.com> wrote:
Show 10 quoted lines
> On 06/15/2011 04:10 PM, Jakub Narebski wrote:
>> BTW. what filesystem do you use?
>>
>
> It was FAT on memory stick as FAT is also there in Windows PC.
> More observation: All files marked modified had only changes in file permissions.
> i.e. 755 instead of 644. chmod doesn't work with FAT so can't change there permissions
> now.
>
> Problem is not only for symlinks but standard c files too.
Sounds like you should try "git config core.filemode false":
"core.fileMode:
     If false, the executable bit differences between the index and
the working copy are ignored; useful on broken filesystems like FAT"
(from from http://kernel.org/pub/software/scm/git/docs/git-config.html)
viresh kumar· Jun 15, 2011, 12:02 UTC · re: Erik Faye-Lund · lore

Re: Copying Git repository from Linux to Windows.

On 06/15/2011 04:56 PM, Erik Faye-Lund wrote:
Show 11 quoted lines
> On Wed, Jun 15, 2011 at 1:04 PM, viresh kumar <viresh.kumar@st.com> wrote:
>> On 06/15/2011 04:10 PM, Jakub Narebski wrote:
> Sounds like you should try "git config core.filemode false":
> 
> "core.fileMode:
>      If false, the executable bit differences between the index and
> the working copy are ignored; useful on broken filesystems like FAT"
> 
> (from from http://kernel.org/pub/software/scm/git/docs/git-config.html)
> .
> 
On 06/15/2011 04:59 PM, Jakub Narebski wrote:
Show 13 quoted lines
> On Wed, 15 June 2011, viresh kumar wrote:
>> On 06/15/2011 04:10 PM, Jakub Narebski wrote:
>>> viresh kumar <viresh.kumar@st.com> writes:
> Ah. This is caused by the fact that FAT doesn't store executable
> permission.
> 
> So beside setting `core.symlinks` to false, you would have also set
> `core.filemode` to false (and perhaps also `core.ignorecase` to true).
> 
> You might also want to set `core.ignoreStat` to true to try to increase
> performace.
> 
> P.S. git-bundle ddidn't work?
didn't tried that. :(
> 

Guys, thanks for your inputs. core.filemode was new to me. I tried to resolved issue in some other way. I have tarred kernel before copying to memory stick. And after untarring kernel on windows, file permission are not changed for all files with permission 644 originally.

There are some files in kernel whose permissions are 755 and they are converted to 644. And are shown in git status as _modified_.

I got rid of them with core.filemode as false, but there is one more issue, as pointed out by Andreas. There are few files in kernel with same file name but in different _cases_ (one in caps and another in small.) and so i am getting issues with these now.

And don't have any idea how to get rid of that? And why does kernel have such file names at all?
-- 
viresh
Andreas Ericsson· Jun 15, 2011, 12:41 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

On 06/15/2011 02:02 PM, viresh kumar wrote:
Show 6 quoted lines
> 
> I got rid of them with core.filemode as false, but there is one more issue, as pointed out by
> Andreas. There are few files in kernel with same file name but in different _cases_ (one in caps
> and another in small.) and so i am getting issues with these now.
> 
> And don't have any idea how to get rid of that?

You can't. git dubs such filesystems as "retarded" and simply can't work around it. Imo, that's the only sensible thing to do.

> And why does kernel have such file names at all?
> 

Because linux kernel developers are expected to work with linux development work using linux and nowhere near enough find it an actual problem for anyone to care about fixing it. Note that all build-scripts and configuration stuff will have to be fixed as well. Complaining about it on lkml will probably have very little effect unless you're a very valuable contributor and/or lots of other people chime in to agree with you.

If I may ask; Why do you need to be able to work with a linux kernel repository on windows?

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
viresh kumar· Jun 16, 2011, 03:33 UTC · re: Andreas Ericsson · lore

Re: Copying Git repository from Linux to Windows.

On 06/15/2011 06:11 PM, Andreas Ericsson wrote:
> If I may ask; Why do you need to be able to work with a linux kernel
> repository on windows?
I can't simply install Linux on my office laptop (company policies, support, etc) :(

And i wanted just linux source on windows, i will not be creating any patches from windows. Just needed code for reference.

-- 
viresh
viresh kumar· Jun 16, 2011, 08:22 UTC · re: Philippe Vaucher · lore

Re: Copying Git repository from Linux to Windows.

On 06/16/2011 01:47 PM, Philippe Vaucher wrote:
>> I can't simply install Linux on my office laptop (company policies, support, etc) :(
> 
> Why not use something like VirtualBox?
> 

Ya. I can, but for now i really don't have to. Just wanted code for reference on windows and i got it at last. Just commited all files still showed in git status.

-- 
viresh
Johannes Sixt· Jun 16, 2011, 08:50 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

Am 6/16/2011 5:33, schrieb viresh kumar:
> And i wanted just linux source on windows, i will not be creating any patches from
> windows. Just needed code for reference.

If you only want to peek into the files, you don't need the files checked out. Just have them in a bare repository and use, e.g.,

  git show master:mm/vmalloc.c

You can also use a sparse checkout to omit the questionable files from the checkout. See man git-read-tree.

-- Hannes
viresh kumar· Jun 16, 2011, 08:55 UTC · re: Johannes Sixt · lore

Re: Copying Git repository from Linux to Windows.

On 06/16/2011 02:20 PM, Johannes Sixt wrote:
Show 10 quoted lines
> Am 6/16/2011 5:33, schrieb viresh kumar:
>> > And i wanted just linux source on windows, i will not be creating any patches from
>> > windows. Just needed code for reference.
> If you only want to peek into the files, you don't need the files checked
> out. Just have them in a bare repository and use, e.g.,
> 
>   git show master:mm/vmalloc.c
> 
> You can also use a sparse checkout to omit the questionable files from the
> checkout. See man git-read-tree.
Thanks. I am doing it this way only.
-- 
viresh
Jakub Narebski· Jun 16, 2011, 14:15 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

viresh kumar wrote:
> On 06/15/2011 06:11 PM, Andreas Ericsson wrote:
Show 7 quoted lines
> > If I may ask; Why do you need to be able to work with a linux kernel
> > repository on windows?
> 
> I can't simply install Linux on my office laptop (company policies, support, etc) :(
> 
> And i wanted just linux source on windows, i will not be creating any patches from
> windows. Just needed code for reference.
Browsing code via gitweb (in a web browser) is not enough?
-- 
Jakub Narebski
Poland
viresh kumar· Jun 17, 2011, 03:52 UTC · re: Jakub Narebski · lore

Re: Copying Git repository from Linux to Windows.

On 06/16/2011 07:45 PM, Jakub Narebski wrote:
Show 10 quoted lines
> viresh kumar wrote:
>> > On 06/15/2011 06:11 PM, Andreas Ericsson wrote:
>>> > > If I may ask; Why do you need to be able to work with a linux kernel
>>> > > repository on windows?
>> > 
>> > I can't simply install Linux on my office laptop (company policies, support, etc) :(
>> > 
>> > And i wanted just linux source on windows, i will not be creating any patches from
>> > windows. Just needed code for reference.
> Browsing code via gitweb (in a web browser) is not enough?

It can be. But my branches wouldn't have been there. They are local. Also, i have fetched many other remote repositories, which i need.

-- 
viresh
Jakub Narebski· Jun 15, 2011, 14:14 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

On Wed, 15.06.2011, viresh kumar wrote:
> On 06/15/2011 04:59 PM, Jakub Narebski wrote:
Show 5 quoted lines
> > Ah. This is caused by the fact that FAT doesn't store executable
> > permission.
> > 
> > So beside setting `core.symlinks` to false, you would have also set
> > `core.filemode` to false (and perhaps also `core.ignorecase` to true).
Show 5 quoted lines
> [...], but there is one more issue, as pointed out by
> Andreas. There are few files in kernel with same file name but in different _cases_ (one in caps 
> and another in small.) and so i am getting issues with these now.
> 
> And don't have any idea how to get rid of that?
core.ignorecase::
        If true, this option enables various workarounds to enable
        git to work better on filesystems that are not case sensitive,
        like FAT. For example, if a directory listing finds
        "makefile" when git expects "Makefile", git will assume
        it is really the same file, and continue to remember it as
        "Makefile".
	The default is false

But that wouldn't unfortunately help when there are two files which filename differs only in case.

You would have to do tricks with `git update-index` and its --assume-unchanged bit (though perhaps `core.ignorecase` would be enough) and `--cacheinfo <mode> <object> <path>` together with `git hash-object -w`...

Or perhaps delete file which you have in working area, checkout one file, add it, checkout other file, add it, use 'git commit' and not 'git commit -a'.

But that are only possible solutions; I have sane filesystem.

Can't you work on NTFS, and use USB stick only for transport of either tarred repository, or bundle?

> And why does kernel have such file names at all? 
That I don't know.
-- 
Jakub Narebski
Poland
Phil Hord· Jun 20, 2011, 19:57 UTC · re: Jakub Narebski · lore

Re: Copying Git repository from Linux to Windows.

On 06/15/2011 10:14 AM, Jakub Narebski wrote:
Show 27 quoted lines
>
> core.ignorecase::
>         If true, this option enables various workarounds to enable
>         git to work better on filesystems that are not case sensitive,
>         like FAT. For example, if a directory listing finds
>         "makefile" when git expects "Makefile", git will assume
>         it is really the same file, and continue to remember it as
>         "Makefile".
>
> 	The default is false
>
> But that wouldn't unfortunately help when there are two files which
> filename differs only in case.
>
> You would have to do tricks with `git update-index` and its 
> --assume-unchanged bit (though perhaps `core.ignorecase` would be
> enough) and `--cacheinfo <mode> <object> <path>` together with
> `git hash-object -w`... 
>
> Or perhaps delete file which you have in working area, checkout
> one file, add it, checkout other file, add it, use 'git commit'
> and not 'git commit -a'.
>
> But that are only possible solutions; I have sane filesystem.
>
> Can't you work on NTFS, and use USB stick only for transport of
> either tarred repository, or bundle?

FWIW - NTFS likely does not help here because even though NTFS supports unique-cased filenames, Windows and Win32-apps do not. http://support.microsoft.com/kb/100625

For example,
cmd.exe:
  C:\> touch makefile
  C:\> copy makefile Makefile
  The file cannot be copied onto itself.
          0 file(s) copied.
cygwin/bash:
  $ touch makefile
  $ cp makefile Makefile
  cp: `makefile' and `Makefile' are the same file
Linux (on NTFS volume):
  mnt/NTFS:  touch makefile
  mnt/NTFS:  cp makefile Makefile
  mnt/NTFS:  ls *akefile
  makefile  Makefile

Mac's "HFS Plus" filesystem supports unique-on-case, but it is not safe to enable it on a boot disk. http://support.apple.com/kb/TA21400?viewlocale=en_US

Phil
Jakub Narebski· Jun 15, 2011, 11:29 UTC · re: viresh kumar · lore

Re: Copying Git repository from Linux to Windows.

On Wed, 15 June 2011, viresh kumar wrote:
> On 06/15/2011 04:10 PM, Jakub Narebski wrote:
>> viresh kumar <viresh.kumar@st.com> writes:
Show 21 quoted lines
>>> After completing copy operation on mem stick, i found something strange.
>>> - git branch shows correct results and is exactly same of state at Linux machine.
>>> - git log is also fine.
>>> - git status, shows me a lot of files are modified, which is not present in Linux.
>> 
>> That is probably because stat information is stale... or stat
>> information doesn't work.  Does second "git status" still show files
>> as modified?
> 
> Yes. The files status is same.
> 
>>> - git reset --hard also doesn't work and fails with following error.
>>>
>>> $ git reset --hard HEAD
>>> error: unable to create symlink arch/microblaze/boot/dts/system.dts (Operation not permitted)
>>> Checking out files: 100% (36696/36696), done.
>>> fatal: Could not reset index file to revision 'HEAD'.
>> 
>> Try setting `core.symlinks` to false, or just try
>> 
>>  $ git -c core.symlinks=false reset --hard HEAD
[...]
Show 7 quoted lines
>> BTW. what filesystem do you use?
>> 
> 
> It was FAT on memory stick as FAT is also there in Windows PC.
> More observation: All files marked modified had only changes in file permissions.
> i.e. 755 instead of 644. chmod doesn't work with FAT so can't change there permissions
> now.

Ah. This is caused by the fact that FAT doesn't store executable permission.

> Problem is not only for symlinks but standard c files too.

So beside setting `core.symlinks` to false, you would have also set `core.filemode` to false (and perhaps also `core.ignorecase` to true).

You might also want to set `core.ignoreStat` to true to try to increase performace.

P.S. git-bundle ddidn't work?
-- 
Jakub Narebski
Poland

← back to recent threads