Rohit Gupta
Rohit Gupta

Reputation: 4193

Can I just physically copy my remote GIT repository to another machine with different OS

At the moment my remote repository is on my development PC (Windows) on a separate drive. I want to move it to my Synology NAS box.

When I Google it, I can only find very complicated methods. Is there anything wrong if I physically copy the directory structure over (I know it's a different OS, but surely the files should be the same). I have "core.autocrlf" set to false.

Before someone tells me, it should be outside my house, I have a NAS box at my batch, and I intend to replicate information there.

Upvotes: 1

Views: 982

Answers (2)

VonC
VonC

Reputation: 1326782

The alternative to copy the full directory structure is a git bundle (see "Fully backup a git repo?").

That way, you have only one file to copy, that you can clone from (yes, clone from a file) on the target system.

git clone foo.bundle
cd foo
git remote set-url origin url-to-original-repository

Upvotes: 2

tmaj
tmaj

Reputation: 35075

Git repos are self contained and copying will be fine; just make sure you're copying 'hidden' folders ('.git').

You could also just clone the repo to the new machine as each clone contains the full history.

From git's About:

Multiple Backups

This means that even if you're using a centralized workflow, every user essentially has a full backup of the main server. Each of these copies could be pushed up to replace the main server in the event of a crash or corruption. In effect, there is no single point of failure with Git unless there is only a single copy of the repository.

Upvotes: 2

Related Questions