Use Github oauth to prepopulate .gitconfig

we are trying to determine if there is a way to use the Github oauth to preconfigure a .gitconfig in the user’s home directory with username and email.

see original issue here: https://github.com/dandi/dandihub/issues/4#issuecomment-573265938

I’ve worked on a similar problem to this. If you are running JupyterHub on a publicly accessible domain, then yes, you can write a service such as a jupyter notebook serverextension to receive OAuth callbacks from GitHub. (There is probably a better way than serverextension if you are managing your own JupyterHub instance.) If not, then you need to somehow proxy GitHub’s callback. For example, I ended up building https://github.com/HDI-Project/github-oauth-gateway to proxy between a Jupyter Lab session (either on localhost or mybinder) and GitHub OAuth.

1 Like

There’s an example in the oauthenticator repo of configuring git credentials from GitHub oauth:

I don’t know when that was last tested, but it looks like it should work