0

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 protected] password eX@mp1e

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

  • magit config
(use-package magit
  :init     
    (setq auth-source-debug 'trivia)
  :config
    (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 protected]")

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.

5
  • I guess that clarifying if you're able to push and telling how your remotes looks like will help.
    – Muihlinn
    Dec 27, 2020 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, 2020 at 18:15
  • please add all the info to the question, comments may not be read, or deleted.
    – Muihlinn
    Dec 27, 2020 at 20:51
  • About the remotes, I mean the url your remote is using. I guess this probably will work: https://[email protected]/ 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, 2020 at 21:02
  • There is a closed issue that references the @ related to overleaf. I hope to try your suggestion tomorrow.
    – prash
    Dec 29, 2020 at 3:15

1 Answer 1

1

I realize this is an old post, but since I solved the username lookup part I want to share in the hopes that someone finds it useful.

I was able to use this question to get the password lookup working using the info from OP. Similarly, I was prompted to enter my username.

I solved the username lookup by adding the following line to ~/.gitconfig:

[url "https://[email protected]"]
    insteadOf = https://gitlab.company.example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.