Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I just copy a git repository to Windows?

Tags:

git

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?

like image 921
skiphoppy Avatar asked Feb 09 '09 16:02

skiphoppy


People also ask

Can you copy a Git repository?

You can clone a repository from GitHub.com to your local computer to make it easier to fix merge conflicts, add or remove files, and push larger commits. When you clone a repository, you copy the repository from GitHub.com to your local machine.

Can I just copy the .Git folder?

Yes you can, but there's no need to copy the full working tree. You can copy just the . git folder without the working tree (i.e. as a "bare" repo) and then checkout the latest working tree on the other machine.


2 Answers

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.

like image 153
paxos1977 Avatar answered Oct 09 '22 11:10

paxos1977


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.

like image 45
Leonidas Avatar answered Oct 09 '22 11:10

Leonidas