Bitbucket has an importer tool for importing repositories from remote locations, but it only supports the git://
protocol. Our existing repositories are on a company controlled machine behind a firewall that I can't change, and git://
is not available. I need to move the repositories from our company machine to bitbucket, keeping all history and details from the original repository intact.
Is there some way I can accomplish this by cloning the original repository via ssh to a local machine, and then pushing that repository to a newly-bare-initted repository on bitbucket? Will I lose any history or data that way?
(I'm hoping for an answer that isn't bitbucket specific, but will work for "moving" a git repository in any case.)
Git can use four distinct protocols to transfer data: Local, HTTP, Secure Shell (SSH) and Git.
Select Repos, Files. From the repo drop-down, select Import repository. If the source repo is publicly available, just enter the clone URL of the source repository and a name for your new Git repository.
You'll want to be sure you have the entire history. You can do this by performing a full local bare clone first.
git clone --mirror git://LOCAL_URL/somerepo.git
Then add the remote and push as Timothy pointed out. Though, you probably want to use something other than origin for the remote alias.
git remote add bitbucket ssh://[email protected]/someuser/somerepo.git
git push -u bitbucket --all
This could be used for any Git hosting service. Simply replace the remote URL with anything you'd like.
From what I know cloning the entire repo and pushing it works. Bitbucket even has the command for you:
cd /path/to/my/repo
git remote add origin ssh://[email protected]/someuser/somerepo.git
git push -u origin --all # to push changes for the first time
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