Pushing to Multiple Repos

Full credit to Alex Armstrong and his helpful article for reminding me how to do this every time I start a new project. So I can better keep track of this, though, these five lines will create a local Git repo, tie GitHub and Bitbucket remote repos to it, and then push to both.

git init git remote add origin {GitHub repo URL} # Get GitHub repo URL git remote set-url --add --push origin {GitHub repo URL} # Get GitHub repo URL git remote set-url --add --push origin {Bitbucket repo URL} # Get Bitbucket repo URL git add .; git commit -m "Initial commit."; git push -u origin master

These simple commands make sure that for all my projects, I have a local copy, a local backup, a cloud backup, and two more off-site copies of all my work — just in case.

Permalink.