Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If I have a GIT repo (bare) on my server, can I move it to another server easily?

Tags:

git

I have a server that is hosting my 'bare' GIT repo for a few projects.

I want to know what it takes to move the GIT to another server?

like image 588
Blankman Avatar asked Jul 22 '10 15:07

Blankman


People also ask

How do I clone a bare repository?

In order to clone your repository to create a new bare repository, you run the clone command with the --bare option. By convention, bare repository directory names end with the suffix . git , like so: $ git clone --bare my_project my_project.

What is the use of bare repository in Git?

A bare Git repository is typically used as a Remote Repository that is sharing a repository among several different people. You don't do work right inside the remote repository so there's no Working Tree (the files in your project that you edit), just bare repository data. And that's it.


2 Answers

Just copy the parent directory to the new machine and have the checked out copies update their remote with git remote set-url <remotename> <url>. Once you've verified that the users can push/pull properly with the new remote you can delete the copy from the old machine.

like image 142
Daenyth Avatar answered Oct 07 '22 15:10

Daenyth


Doesn't this work?

  • clone it locally
  • create a new empty bare repo in the other server
  • then push the clone.
like image 24
Scharron Avatar answered Oct 07 '22 14:10

Scharron