Skip to content

Instantly share code, notes, and snippets.

@jnaecker
Last active March 10, 2025 21:00
Show Gist options
  • Save jnaecker/da8c1846bc414594783978b66b6e8c83 to your computer and use it in GitHub Desktop.
Save jnaecker/da8c1846bc414594783978b66b6e8c83 to your computer and use it in GitHub Desktop.
Using Overleaf as your TeX editor but getting your files to Github

git + overleaf + github

Setup

Connect Overleaf and your local repo

  1. Make a new project on Overleaf.
  2. In the share menu, copy the link from "Clone with git"
  3. On your computer:
    • use cd to navigate to where you want to put your project
    • type mkdir and then the name of the project
    • cd into that project
    • do git init
    • do git remote add overleaf with the link you copied
    • so overall this would like something like this
cd ~/Desktop
mkdir overleaf-project
cd overleaf-project
git init
git remote add overleaf https://git.overleaf.com/11205025wxdxfsqpxytc
git pull overleaf master

Connect your local repo and Github

  1. Make a new repo on Github
  2. Copy the git remote link
  3. On your computer:
git remote add github https://github.com/jnaecker/overleaf-project.git
git push github master

Regular Workflow

  1. Make some changes on Overleaf
  2. On your computer (while in the local repo directory), run
git pull overleaf master
git push github master

Any changes you made on overleaf should now be on both your local repo and on Github!

If you want to make changes via your local repo, just push to both remote repos (after staging and committing locally):

git add .
git cm "Adding stuff from local repo"
git push overleaf master
git push github master

You may also want to check out this paper which explains how you get set up git to push to both Overleaf and Github with just one git push command.

@Pat-Lafon
Copy link

Hi, Thanks for the post. After "git pull overleaf master", I get "Could not resolve host: www.git.overleaf.com" error. What should I do?

For anyone else who runs into this, a quick

git config --global --unset http.proxy
git config --global --unset https.proxy

worked for me. I'm sure only one of the two is necessary depending on your setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment