I have cloned a project from a server using git clone
and I now want to copy it (all branches) to another server so other people can start using it. I guess I could simply copy the entire repository manually and then issue git config --bool core.bare true
and delete everything but the .git
folder but I don't think that qualifies as a 'bare' repository and I'm worried it might give me problems.
I was hoping I could create the new remote repository using git init --bare
and simply push my local one to it but as I originally cloned my local copy from another server, the origin
seems to be blocking me from doing this.
To clone a Git repository, you will first copy the remote URL from your repository hosting service—in this case GitHub. You will then use the Git clone command followed by the remote repo's URL. If you are working with a private repository, you will be prompted for your remote hosting service credentials.
You can use Sourcetree, Git from the command line, or any client you like to clone your Git repository. These instructions show you how to clone your repository using Git from the terminal. From the repository, select the Clone button. Copy the clone command (either the SSH format or the HTTPS).
The `git clone` command can create a new local repository by copying an existing local repository.
git init --bare newrepo.git
git remote add newrepo git://[email protected]/newrepo.git
git push newrepo master
to push a particular branch, orgit push --all newrepo
to push all branchesAnother way is (as you wished):
git clone --bare /path/to/repo newrepo.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With