Two-step git import over ssh

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?

  • Complex setup for GIT: fork from Github to Bitbucket, PUSH to Bitbucket only
  • How to make my local git copy always at its latest version automatically?
  • Updating all repos in a folder?
  • Checkout, Fetch and Pull in BitBucket SourceTree
  • Pycharm and bitbucket plugin
  • Adding remote upstream to git repo on bit bucket
  • (I’m hoping for an answer that isn’t bitbucket specific, but will work for “moving” a git repository in any case.)

  • The remote end hung up unexpectedly while Git push with large files
  • Legacy code started this job. No cause information is available
  • How to re-merge a file in the git?
  • git command to add/stage modified files in folders only
  • Git reuse branch or delete and create again
  • how to reset develop branch to master
  • 3 Solutions collect form web for “Two-step git import over ssh”

    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://
    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://
    git push -u origin --all   # to push changes for the first time

    What makes you think that we only support the git:// protocol? We support the smart http protocol and so for instance you can just import

    So if your repo is accessible from the Internet and does HTTP(S) then you should have no problem using the importer (which does a proper clone and do preserves history).

    Git Baby is a git and github fan, let's start git clone.