If you have access to that repository, then simply cloning it to your local machine is all you need to do to get a full copy of it. For example:
git clone [email protected]:username/repository.git
Now, if you want to store a copy of it online, you can just create a new repository on Bitbucket where you push to. After filling out the form there, Bitbucket will give you a quick help on how to push your data inside. Choose “I have an existing project” and the following will show up:
Already have a Git repository on your computer? Let's push it up to Bitbucket.
cd /path/to/my/repo
git remote add origin [email protected]:your_username/new-repo.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
Want to grab a repo from another site? Try our importer!
You just need to follow those instructions closely. You will have to choose a different remote name though as with your cloning, origin
is already taken:
git remote add mycopy [email protected]:your_username/new-repo.git
git push -u mycopy --all
git push -u mycopy --tags
Or you have to remove the origin
remote first:
git remote remove origin
After pushing, your repository at Bitbucket will have the full contents, so your backup is ready.
The other, and probably simpler, option is to simply fork your friends’ repository directly. You can do that by visiting the Bitbucket page, then click the “…” icon in the top left and choose “Fork”. This will let you create a direct copy of the repository directly on Bitbucket.
git remote add github https://github.com/myhappyproject
will give the repo athttps://github.com/myhappyproject
the namegithub
, so that in the next command you can dogit push -f --tags github refs/heads/*:refs/heads/*
to push to that url. – Takishatakken