Two-step import of git by ssh

Bitbucket has an importer mechanism for importing repositories from remote locations, but it only supports the git:// protocol. Our existing repositories are located on a company-managed machine behind a firewall, which I cannot change, and git:// not available. I need to transfer the repositories from our company machine to a bitbucket, saving all the history and details from the original storage.

Is there a way to do this by cloning the source repository via ssh to the local computer, and then clicking that repository on the recently released repository on the bitpack? Can I lose history or data this way?

(I hope for an answer that is not specific to the bitpack, but will work in any case to “move” the git repository.)

+6
source share
3 answers

You want to be sure that you have the whole story. You can do this by first running a full local naked clone.

 git clone --mirror git://LOCAL_URL/somerepo.git 

Then add the remote control and press as Timothy pointed out. Although you probably want to use something other than the source for the remote alias.

 git remote add bitbucket ssh:// git@bitbucket.org /someuser/somerepo.git git push -u bitbucket --all 

This can be used for any Git service. Just replace the remote URL with anything.

+8
source

From what I know, it clones the entire repo and pushes it. Bitbucket even has a command for you:

 cd /path/to/my/repo git remote add origin ssh:// git@bitbucket.org /someuser/somerepo.git git push -u origin --all # to push changes for the first time 
+5
source

What makes you think that we only support the git: // protocol? We support smart http protocol and, for example, you can simply import https://github.com/jquery/jquery

So, if your repo is accessible from the Internet and HTTP (S), then you should not have problems with the importer (who makes the correct clone and saves the history).

-1
source

All Articles