Upload an existing Git repository to a remote GitHub, Bitbucket, Beanstalk...
These are the steps I followed to upload my existing local git repository to a new Bitbucket repository while keeping the whole commit history. You can use this simple steps to move your source code to GitHub, Beanstalk or any other repository you like, commands are just the same. I put as example Bitbucket because you can have unlimited private repositories for free.
How to do it...
- Register to bitbucket for free, add your SSH key, and create an empty repo.
- Add your public key to your account under Account
> SSH keys (this is just pasting the content after a
cat ~/.ssh/id_rsa.pub
, writessh-keygen
if you don't have one) - Then you have an URL for cloning like this: git@bitbucket.org:your_user/your_repo.git
- Then go to the folder where your repo is:
cd /path/to/my/repo
- Then upload it to Bitbucket:
git push --mirror git@bitbucket.org:youruser/your_repo.git
That's it, with this you will be able to keep the whole log history, as shown in the sample picture