# Copying Git repository from Linux to Windows.

17 messages from 2011-06-15 to 2011-06-20. Participants: viresh kumar, Andreas Ericsson, Jakub Narebski, Erik Faye-Lund, Philippe Vaucher, Johannes Sixt, Phil Hord.
Thread: https://gitlist.dev/t/27627

## viresh kumar, 2011-06-15 09:28

Subject: Copying Git repository from Linux to Windows.
Message-ID: <4DF87B42.1020004@st.com>
URL: https://gitlist.dev/e/4DF87B42.1020004%40st.com

```
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, 2011-06-15 09:47

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF87FB6.2080503@op5.se>
URL: https://gitlist.dev/e/4DF87FB6.2080503%40op5.se
In-Reply-To: <4DF87B42.1020004@st.com>

```
On 06/15/2011 11:28 AM, viresh kumar wrote:
> 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, 2011-06-15 10:40

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <m3ei2vv0nw.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3ei2vv0nw.fsf%40localhost.localdomain
In-Reply-To: <4DF87B42.1020004@st.com>

```
viresh kumar <viresh.kumar@st.com> writes:

> 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?

> - 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, 2011-06-15 11:04

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF891CC.1040700@st.com>
URL: https://gitlist.dev/e/4DF891CC.1040700%40st.com
In-Reply-To: <m3ei2vv0nw.fsf@localhost.localdomain>

```
On 06/15/2011 04:10 PM, Jakub Narebski wrote:
> 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.

>> - 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, 2011-06-15 11:26

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <BANLkTik+oUb1QpVTwJfB30_8FsW=4ZVTxA@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTik%2BoUb1QpVTwJfB30_8FsW%3D4ZVTxA%40mail.gmail.com
In-Reply-To: <4DF891CC.1040700@st.com>

```
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:
>> 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)

```

## Jakub Narebski, 2011-06-15 11:29

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <201106151329.53839.jnareb@gmail.com>
URL: https://gitlist.dev/e/201106151329.53839.jnareb%40gmail.com
In-Reply-To: <4DF891CC.1040700@st.com>

```
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:

>>> 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
[...]
>> 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

```

## viresh kumar, 2011-06-15 12:02

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF89F56.3060200@st.com>
URL: https://gitlist.dev/e/4DF89F56.3060200%40st.com
In-Reply-To: <BANLkTik+oUb1QpVTwJfB30_8FsW=4ZVTxA@mail.gmail.com>

```
On 06/15/2011 04:56 PM, Erik Faye-Lund wrote:
> 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:
> 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, 2011-06-15 12:41

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF8A896.7080708@op5.se>
URL: https://gitlist.dev/e/4DF8A896.7080708%40op5.se
In-Reply-To: <4DF89F56.3060200@st.com>

```
On 06/15/2011 02:02 PM, viresh kumar wrote:
> 
> 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.

```

## Jakub Narebski, 2011-06-15 14:14

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <201106151614.06529.jnareb@gmail.com>
URL: https://gitlist.dev/e/201106151614.06529.jnareb%40gmail.com
In-Reply-To: <4DF89F56.3060200@st.com>

```
On Wed, 15.06.2011, viresh kumar wrote:
> On 06/15/2011 04:59 PM, Jakub Narebski wrote:

> > 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).
  
> [...], 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

```

## viresh kumar, 2011-06-16 03:33

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF97998.7070604@st.com>
URL: https://gitlist.dev/e/4DF97998.7070604%40st.com
In-Reply-To: <4DF8A896.7080708@op5.se>

```
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

```

## Philippe Vaucher, 2011-06-16 08:17

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <BANLkTinT8oH+aBnn+zqFYyFbcU+PNPVeVA@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTinT8oH%2BaBnn%2BzqFYyFbcU%2BPNPVeVA%40mail.gmail.com
In-Reply-To: <4DF97998.7070604@st.com>

```
> I can't simply install Linux on my office laptop (company policies, support, etc) :(

Why not use something like VirtualBox?

Philippe

```

## viresh kumar, 2011-06-16 08:22

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF9BD5C.5000901@st.com>
URL: https://gitlist.dev/e/4DF9BD5C.5000901%40st.com
In-Reply-To: <BANLkTinT8oH+aBnn+zqFYyFbcU+PNPVeVA@mail.gmail.com>

```
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, 2011-06-16 08:50

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF9C3BA.8010106@viscovery.net>
URL: https://gitlist.dev/e/4DF9C3BA.8010106%40viscovery.net
In-Reply-To: <4DF97998.7070604@st.com>

```
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, 2011-06-16 08:55

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DF9C4F7.6020305@st.com>
URL: https://gitlist.dev/e/4DF9C4F7.6020305%40st.com
In-Reply-To: <4DF9C3BA.8010106@viscovery.net>

```
On 06/16/2011 02:20 PM, Johannes Sixt wrote:
> 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, 2011-06-16 14:15

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <201106161615.04870.jnareb@gmail.com>
URL: https://gitlist.dev/e/201106161615.04870.jnareb%40gmail.com
In-Reply-To: <4DF97998.7070604@st.com>

```
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?

-- 
Jakub Narebski
Poland

```

## viresh kumar, 2011-06-17 03:52

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DFACF8A.6000909@st.com>
URL: https://gitlist.dev/e/4DFACF8A.6000909%40st.com
In-Reply-To: <201106161615.04870.jnareb@gmail.com>

```
On 06/16/2011 07:45 PM, Jakub Narebski wrote:
> 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

```

## Phil Hord, 2011-06-20 19:57

Subject: Re: Copying Git repository from Linux to Windows.
Message-ID: <4DFFA60C.1070006@cisco.com>
URL: https://gitlist.dev/e/4DFFA60C.1070006%40cisco.com
In-Reply-To: <201106151614.06529.jnareb@gmail.com>

```
On 06/15/2011 10:14 AM, Jakub Narebski wrote:
>
> 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

```
