How does the Jupyterlab-Git obtain user credentials for Github?


I’m a new jupyterlab extension builder, and a big fan of the jupyterlab-git extension in particular. I was hoping to better understand the extension better so I could build a stripped-down version for personal/team use.

One thing that’s confusing is how the extension actually obtains a user’s github credentials. When I launch jupyterlab, jupyterlab-git somehow already has the right credentials/repo, without needing any user input. How is this happening? (I’m assuming this is happening on the server side…but @fcollonval please correct me if I’m wrong).

Apologies if I’m asking this in the wrong venue - let me know if there’s a better place to ask these types of questions.

Hey, up to now, the extension is not handling credentials. The only feature available is to request username and password if authentication failed. But even in that case, the credentials are not stored by the extension (and will be requested again at the next action needed it).

That said, git has a powerful credentials API that allows third parties to define credentials storage method. For example on windows, there is the plugin by Microsoft Git Credential Manager for Windows | Git-Credential-Manager-for-Windows.
So if you have such credentials manager installed, once you have loaded your credentials in one software calling the git command, it will be reused by git in all others.

1 Like

Also see Saving GIT credentials for next push to remote repo · Discussion #904 · jupyterlab/jupyterlab-git · GitHub

1 Like