I have a project in Overleaf and I have a private repository for my project in Github. These two are currently in no way linked. I want to push the overleaf project changes to this particular github repo whenever I make a change in overleaf so I can push it to github. I have cloned the github repo for in my system. The github repo just contains a readme File. How exactly should I proceed ?
2 Answers
I want to push the overleaf project changes to this particular github repo
One possible solution is to reference that public Overlead repo in your private repo.
You can declare Overleaf as a Git submodule in your private repo in order to keep a reference to a SHA1 of the Overleaf repo.
Anytime, in your private repo, you want to refresh the content of Overleaf to the latest commit pushed to its master
branch, do a git submodule update --remote
, and you will reference its latest master
HEAD SHA1.

- 1,262,500
- 529
- 4,410
- 5,250
-
I'm trying what you suggested to refresh the content of the Overleaf to the latest commit pushed to its `master` branch, but when I run `git submodule update --remote` it tells me `Needed a single revision. Unable to find current origin/master revision in submodule path`. But the Overleaf repo has been updated and committed to multiple times so I don't know why it's telling me there are no revisions – Sam Pickwick Apr 20 '21 at 19:57
-
-
yeah committed and pushed. If I go to the Overleaf repo on the GitHub website it shows up there too. – Sam Pickwick Apr 20 '21 at 21:53
-
Maybe I should clarify. I'm making changes to the Overleaf project and committing/pushing to that repo but those changes are only showing up in the Overleaf repo. Not the repo for which the Overleaf is a submodule of – Sam Pickwick Apr 20 '21 at 21:55
-
@SamPickwick Is the URL mentioned in the `.gitmodules` file the same as the Overleaf one? And what is its branch? `master` or, more recently, `main`? – VonC Apr 20 '21 at 22:43
-
The url is the same, but there is no branch listed in the .gitmodules documentation for the submodules. In the Overleaf repo all commits and pushes have been to `main`. – Sam Pickwick Apr 21 '21 at 01:02
-
@SamPickwick OK. I have suggested to track the branch explicitly in your question: https://stackoverflow.com/a/67190974/6309 – VonC Apr 21 '21 at 07:25
If the github repo only has a readme which isnt of importance then I would forgo it and just link it to github from the project menu
(I had the same question and I believe this to be a more modern solution per https://www.overleaf.com/learn/how-to/Using_Git_and_GitHub#Creating_a_new_GitHub_repository_from_an_Overleaf_project)

- 1,175
- 1
- 12
- 32