I'm moving a git repository from my Linux machine to a Windows machine. I was hoping to just move the entire directory tree and find that things will "just work." Is this the case? Do I need to do anything about line endings?
Asked
Active
Viewed 9,055 times
22
-
Does the same apply to a git-svn repository? – Vincent Oberle Jan 20 '12 at 20:59
-
1This question is even more relevant with the arrival of bash on Windows. When I switch to bash, I realize that the git in the ubuntu environment has a completely different view (lots of untracked files) of the repository. In Windows, git sees it in a clean, all files tracked, state. – codinguser Oct 31 '16 at 11:06
2 Answers
29
You don't even need the entire directory structure, just grab the .git directory and move it to your windows machine. Then run "git reset --hard" and it should rebuild the rest of the directory structure for you.

oz10
- 153,307
- 27
- 93
- 128
-
1
-
2Yes, you need to take care of line-ending as Windows uses both, a carriage-return char and a linefeed char for newlines whereas linux uses only the latter. To handle this on windows, run 'git config --global core.autocrlf true'. – Ethan May 18 '12 at 15:58
-
1Here is a good link if are still facing problems: http://stackoverflow.com/questions/1510798/trying-to-fix-line-endings-with-git-filter-branch-but-having-no-luck/1511273#1511273 – Ethan May 18 '12 at 19:36
-
awesome and super-fast! e.g. better/faster than git svn clone if you already have same elsewhere. although in that case needs git svn rebase afterwards to recreate empty directories. – Dima Tisnek Sep 06 '12 at 14:00
7
Why don't you "git pull" the repo?
PS: Of course - "git clone" it (first). Point is: every git-repo is as valid as its clones.

Leonidas
- 2,440
- 15
- 22
-
Can you give me more detail? I thought my options were to clone or copy; will git pull give me an identical repository instead of remote tracking branches? – skiphoppy Feb 09 '09 at 16:52
-
1Yes, of course "git clone" the repo. "git pull" would come afterwards, if you still made changes to the linux-based repo. – Leonidas Feb 09 '09 at 17:09
-
The problem I thought with that was getting remote tracking branches instead of real branches; it seems that when I clone to another machine, however, that doesn't happen. So, thanks. :) – skiphoppy Feb 09 '09 at 22:32