4

I am writing a project on Overleaf and have a local copy via git. I did some local changes and now my local version is out of sync with the Overleaf one. I tried to git push --force my local changes (since I want to rewrite the Overleaf repo), but I get a permission error. Anyone knows how I can enable git push --force on Overleaf?

7
  • 3
    Hmmm, this is probably best asked to Overleaf's tech support...
    – Rmano
    Jun 7, 2021 at 17:40
  • @Rmano I tried that. But didn't get a reply :(
    – a06e
    Jun 7, 2021 at 19:53
  • this is really off topic here, but just checking, you do have the pro version of overleaf? The github linkage is not available to the free version as far as I know. Jun 7, 2021 at 20:14
  • 1
    @PaulGessler Yes, thanks. Do you want to post an answer? Can be useful to other users.
    – a06e
    Jun 8, 2021 at 7:07
  • 1
    You cannot force the push action. The correct way is (1) to do git pull and then (2) to do git push. Between (1) and (2), you can choose which version to keep (your version, the Overleaf version or a merge between the two versions). Apr 8, 2022 at 9:30

1 Answer 1

5

In case someone else has the same question, I got the following answer from Overleaf support.

TLDR; It's not possible to force push to Overleaf.

Hi there,

Thanks for getting in touch about this. Force pushing to an Overleaf remote isn't possible at the moment, sorry for the limitation here. Usually force pushing is not necessary: if there is a merge conflict, it can be resolved in the usual way.

If you really do need to force push, it would be good to understand more about the situation you're in so we can advise how to resolve this. One workaround would be to re-apply your changes over the top of the current Overleaf remote head.

The process would be similar to steps 5-8 here: https://www.overleaf.com/learn/how-to/Using_Git_and_GitHub#Creating_an_Overleaf_project_from_an_existing_Git_repository but would need to be adapted to your situation. Those directions are for a new Overleaf project based on some existing git repository that has a differing history to Overleaf's. But the steps would be similar to re-apply your changes from Overleaf's current state.

If you could explain more about the changes you need to commit, and the current state of the Overleaf project (ideally with an example project), we might be able to provide more specific advice on how to work around this.

Thanks,

Paul

3
  • So what was your specific case that you needed a force push?
    – Paloha
    Oct 10, 2022 at 12:09
  • 2
    I did a lot of modifications locally, while also doing some accidental modifications on the overleaf web. I want to overwrite the overleaf version with my local changes. My collaborators are aware of I'm doing, so the simplest solution would be to force push the changes and that's it!
    – a06e
    Oct 10, 2022 at 13:53
  • I ended up in a similar situation after attempting to clean up git history. Mar 18, 2023 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .