- Make a new project on Overleaf.
- In the share menu, copy the link from "Clone with git"
- 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
- use
cd ~/Desktop
mkdir overleaf-project
cd overleaf-project
git init
git remote add overleaf https://git.overleaf.com/11205025wxdxfsqpxytc
git pull overleaf master
- Make a new repo on Github
- Copy the git remote link
- On your computer:
git remote add github https://github.com/jnaecker/overleaf-project.git
git push github master
- Make some changes on Overleaf
- 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
.
Hi all -- I continue to be flattered that folks are referring to this quick document I put up as a helpful resource.
Some updates:
First, as @da5nsy noted, you can now push to and pull from GitHub directly in the Overleaf UI. To set this up, go to
Menu
in the upper right, then underSync
you will see aGitHub
option. Click that and follow the directions to connect your Overleaf project to a GitHub repo. You will need to authorize Overleaf to read/write to your GitHub repos. Once things are set up, go to that same location (Menu
>Sync
>GitHub
) to pull in any commits from GitHub or push your recent Overleaf work as a commit. If you want to use Overleaf as your only editor, this should be all you need to leverage GitHub for version control and collaboration.Second, if you prefer, the original workflow that I outlined above does still seem to work, with a couple caveats:
Menu
>Sync
>Git
, as @felixvuo noted.main
instead ofmaster
. It seems that Overleaf still expects a branch calledmaster
, however. So you may need to rename yourmain
branch with the commandgit branch -m master
. Or you can change the default on your preferences in GitHub.Finally, note that I was able to do all of these with a basic Overleaf membership. However, the Overleaf documentation does clearly say that both the Git and GitHub integrations are for Premium memberships only. I'm not sure how I was able to get around this; perhaps since I had already set up the integrations a long time ago, I was legacied in.