Pushing to a local bare Git repository

Now that we have a local copy of our repository, we can move it to a brand new Git repository. Here, you can already use a remote repository on your server of choice, even GitHub or BitBucket, but I recommend that you use a local bare repository. We may as well do some other little adjustments (such as renaming tags and branches) before pushing files to a blessed repository. So, first initialize a bare repository in a folder of choice:

$ mkdir ReposMyGitRepo.git
$ cd ReposMyGitRepo.git
$ git init --bare

Now, make the default branch to match the Subversion trunk branch name:

<pre>$ git symbolic-ref HEAD refs/heads/trunk

Then, add a bare remote pointing to the bare repository we just created:

$ cd SourcesMySvnRepo
$ git remote add bare file:///C/Repos/MyGitRepo.git

Finally, push the local cloned repository to the new bare one:

$ git push --all bare

We have now a brand new bare repository that is a perfect copy of the original Subversion one. We can now adjust branches and tags to fit the Git usual layout better.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.105.239