vermiculus / magithub

**DEPRECATED - please use Forge instead!** -- Magit-based interfaces to GitHub
GNU General Public License v3.0
579 stars 62 forks source link

authinfo.gpg + magithub +2 way authentication does not work #360

Closed DrWaleedAYousef closed 5 years ago

DrWaleedAYousef commented 5 years ago

I am fed up using authinfo.gpg to store the credentials, knowing that I am using two factor authentication. My authinfo.gpg is: machine api.github.com login DrWaleedAYousef^magithub password MYTOKEN

vermiculus commented 5 years ago

Are you able to successfully execute the following?

(ghub-get "/issues" nil :auth 'magithub)
DrWaleedAYousef commented 5 years ago

Before trying this, is this a sound emacs file:

(use-package magit) (use-package magithub)

On Sun, Aug 12, 2018, 5:34 PM Sean Allred notifications@github.com wrote:

Are you able to successfully the following?

(ghub-get "/issues" nil :auth 'magithub)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vermiculus/magithub/issues/360#issuecomment-412350748, or mute the thread https://github.com/notifications/unsubscribe-auth/ALpbzfB7YV7wGnFfWERAWkppNr56UgD6ks5uQEr4gaJpZM4V5hpv .

vermiculus commented 5 years ago

Looks good to me.

DrWaleedAYousef commented 5 years ago

I used this initialization yesterday; it was working. Today, whenever Emacs starts it gives me this error:

Error (use-package): Failed to install magithub: https://melpa.org/packages/magithub-20180804.19.tar: Not found Error (use-package): Cannot load magithub

Sean Allred notifications@github.com writes:

Looks good to me.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

DrWaleedAYousef commented 5 years ago

The strange thing is that, I tried your statement:

(ghub-get "/issues" nil :auth 'magithub)

it seems that it fetched my Repos !!

Waleed Yousef wyousef@fcih.net writes:

I used this initialization yesterday; it was working. Today, whenever Emacs starts it gives me this error:

Error (use-package): Failed to install magithub: https://melpa.org/packages/magithub-20180804.19.tar: Not found Error (use-package): Cannot load magithub

Sean Allred notifications@github.com writes:

Looks good to me.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

DrWaleedAYousef commented 5 years ago

Update: to help you more. After magit-status I do magit-gh-pulls-mode, then # g. It seems to be able to read some of the PR information. However, it cannot retrieve more when I hit on the result. Moreover, when I do P u (to push) it keeps asking me for the username and password. It cannot get them up from the authinfo.gpg

I hope this helps you tracing.

Waleed Yousef wyousef@fcih.net writes:

The strange thing is that, I tried your statement:

(ghub-get "/issues" nil :auth 'magithub)

it seems that it fetched my Repos !!

Waleed Yousef wyousef@fcih.net writes:

I used this initialization yesterday; it was working. Today, whenever Emacs starts it gives me this error:

Error (use-package): Failed to install magithub: https://melpa.org/packages/magithub-20180804.19.tar: Not found Error (use-package): Cannot load magithub

Sean Allred notifications@github.com writes:

Looks good to me.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

DrWaleedAYousef commented 5 years ago

Update: to help you more. After magit-status I do magit-gh-pulls-mode, then # g. It seems to be able to read some of the PR information. However, it cannot retrieve more when I hit on the result. Moreover, when I do P u (to push) it keeps asking me for the username and password. It cannot get them up from the authinfo.gpg

I hope this helps you tracing.

Waleed Yousef wyousef@fcih.net writes:

The strange thing is that, I tried your statement:

(ghub-get "/issues" nil :auth 'magithub)

it seems that it fetched my Repos !!

Waleed Yousef wyousef@fcih.net writes:

I used this initialization yesterday; it was working. Today, whenever Emacs starts it gives me this error:

Error (use-package): Failed to install magithub: https://melpa.org/packages/magithub-20180804.19.tar: Not found Error (use-package): Cannot load magithub

Sean Allred notifications@github.com writes:

Looks good to me.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

I kept trying; I uninstalled magit, magit-popup, and magithub; then I just started emacs with: (use-package magit) (use-package magithub)

it installed and the error I sent you is gone. Now, I am sending you this comment with emacs while I am viewing the issue. Your package is great. Thanks so much.

The only remaining thing is the pull/push/... without asking for the password and the username.

vermiculus commented 5 years ago

The only remaining thing is the pull/push/... without asking for the password and the username.

Sorry for taking so long to round back on this. Which credentials is it asking for? It's sounding like this is git asking for the credentials to do its thing -- not necessarily magithub (though I don't know for sure).

DrWaleedAYousef commented 5 years ago

I had a long thread with the author of magit on that (actually it was an open thread between you and him and I commented on it; then we kept exchanging replies, but I cannot find it now). We concluded that it is credentials asked by Git and magit does not interact with that. So, it is left to me to teach Git how to get this credentials.

I shared with him my interest if magit can handle this on my behalf and pass it to Git as long as magit already does that for PR and other things with Github; why not?

On the other hand, I found a semi get around for that. Since, I am using https with 2-way authentication, it is impossible then to use SSH. The only thing I found on Git documentation is to use temporary memory, so that I enter the credentials one time then Git remember that for sometime I specify, which can be kept as long as necessary. It is by adding this to .gitconfig

[credential]
    helper = cache --timeout=36000

EDIT: Oh, I found the issue that I mentioned above; you already have commented on it.

vermiculus commented 5 years ago

I'm glad everything got sorted out 😄