Overleaf allows git for some users. I have been using emacs and magit with overleaf since some time by providing username-password at each git push or git pull.

What I want

Now I want to configure magit to use username and password from my .authinfo file so that it does not ask me credentials at each push or pull.

What I have

  • Overleaf does not allow ssh public key based authentication right now.
  • Using GNU Emacs 27.1 with Magit 20201218.1819.
  • authinfo entry

machine git.overleaf.com port 443 login email@example.com password eX@mp1e

I have also tried machine https://git.overleaf.com login email@example.com password eX@mp1e

  • magit config
(use-package magit
    (setq auth-source-debug 'trivia)
    (add-hook 'magit-process-find-password-functions 'magit-process-password-auth-source))

What I get

When I try to do a git push, it asks for my username. After I type in my email address (which is my username), it returns this message:

auth-source-search: found 1 results (max 1) matching (:max 1 :host "git.overleaf.com" :user "email@example.com")

And the committed changes get pushed successfully. So I guess this is a minor success since magit is able to lookup the password from the authinfo file when I provide the username.

  • I guess that clarifying if you're able to push and telling how your remotes looks like will help.
    – Muihlinn
    Dec 27 '20 at 9:13
  • I'm able to push after I type the username (which is my email). I'm not sure what you mean by 'how your remote looks like'. I want to push without typing the username.
    – prash
    Dec 27 '20 at 18:15
  • please add all the info to the question, comments may not be read, or deleted.
    – Muihlinn
    Dec 27 '20 at 20:51
  • About the remotes, I mean the url your remote is using. I guess this probably will work: https://username@git.overleaf.com/ if your username contains a @ usually replacing it with %40 does the trick from the command line, I never tried with authinfo file. Also there is the git credential system as last resort.
    – Muihlinn
    Dec 27 '20 at 21:02
  • There is a closed issue that references the @ related to overleaf. I hope to try your suggestion tomorrow.
    – prash
    Dec 29 '20 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.