Using git with Overleaf

The git repo for an Overleaf project is located at https://git.overleaf.com/x where x is https://www.overleaf.com/project/x.

To get the repo on the local machine:

  1. Navigate to the dir that you want to place the repo in.
  2. Think of a name for the repo on the local machine: y
  3. Enter the command: git clone -o overleaf https://git.overleaf.com/x y

To pull from overleaf to local machine

  1. Enter the command: git pull overleaf

To backup the repo on bitbucket with owner username

  1. Navigate to https://bitbucket.org/username/workspace/create/repository
  2. Name the repo y, fill out the rest of the form, and create repo.
  3. Navigate to dir/y on your local machine.
  4. Enter the command: git remote add bitbucket git@bitbucket.org:username/y.git
  5. Enter the command: git push bitbucket --force

To make pushing to both remote repos easier from local machine

  1. Navigate to dir/y on your local machine.
  2. Enter the command: git remote add all https://git.overleaf.com/x
  3. Enter the command: git remote set-url --add --push all https://git.overleaf.com/x
  4. Enter the command: git remote set-url --add --push all git@bitbucket.org:username/y.git

To push to overleaf and bitbucket from local machine

  1. Enter the command: git push all