How do I create a '.git' file folder from an existing git repository?

136 views Asked by At

I have a git repository called "shop" that has the remote "oldserver.com"

[email protected]:shop.git

How do I create the shop.git folder from my local repository, so I can load it on my "newserver.com" (that uses gitolite or gitosis) so we can use that as a new remote?

1

There are 1 answers

5
michas On

If I understood your question correctly, you have three repositories:

  • a remote repository at oldserver.com, which was used to host your code
  • a remote repository at newserver.com, which you want to host your code now
  • a local repository, which has oldserver.com defined as remote "origin"

Assuming you already pulled everything from oldserver into your local repository and you already created the new repository in gitosis on newserver, and you configured gitosis to allow you access to that new repository, you can do:

git remote add newserver [email protected]:shop.git
git push newserver master

If you have any other branches or tags, just push them, too.


If you need to manually create the repository on newserver you can use:

git clone --mirror [email protected]:shop.git

In this case there is no need to push anything.