coderefinery / installation

CodeRefinery workshop software installation instructions.
https://coderefinery.github.io/installation/
Creative Commons Attribution 4.0 International
3 stars 15 forks source link

git-bash (windows): use credential manager? #249

Open rkdarst opened 11 months ago

rkdarst commented 11 months ago

[this is for CR-next, not the one right now]

From https://gitforwindows.org/

Git Credential Manager

Git Credential Manager provides secure credential storage with authentication to GitHub, Azure Repos, and other popular Git hosting services.

This could be useful to simplify things. I haven't used this at all yet.

rkdarst commented 11 months ago

Our installation instructions alreday say to enable this.

From it's info:

How to use

Once it's installed and configured, Git Credential Manager is called implicitly by Git. You don't have to do anything special, and GCM isn't intended to be called directly by the user. For example, when pushing (git push) to Azure DevOps, Bitbucket, or GitHub, a window will automatically open and walk you through the sign-in process. (This process will look slightly different for each Git host, and even in some cases, whether you've connected to an on-premises or cloud-hosted Git host.) Later Git commands in the same repository will re-use existing credentials or tokens that GCM has stored for as long as they're valid.

This seems pretty good for us!

We'd probably need to update instructions here: https://coderefinery.github.io/installation/ssh/

... it seems a reasonable default for Windows. Mac requires installing an extra package (which may not be supported on everyone's computer). Linux seems like a lot of work (choosing backend, none is perfect).

We could add a test to see if you can already authenticate (via credential manager), and then set up ssh keys if not.

bast commented 11 months ago

SSH keys is indeed a big barrier.

rkdarst commented 11 months ago

I think for now, highest priority is a way to check that authentication works other than ssh git@github.com - so we can use this as new first step in verification / deciding if we need to mess with ssh keys.

rkdarst commented 11 months ago

A fresh install and these commands automatically has you sign in to Github via a web browser, no extra config needed:

git clone https://github.com/coderefinery/installation/
cd installation
git commit --allow-empty -m "empty commit"

Then this error message comes (which means it's works, it tried to authenticate):

$ git push
info: please complete authentication in your browser...
remote: Permission to coderefinery/installation.git denied to mhakala.
fatal: unable to access 'https://github.com/coderefinery/installation/': The requested URL returned error: 403
rkdarst commented 11 months ago

gcm requires https to work. So lesson instructions will need two versions of URLs, or a way to tell users to select the right one (https or ssh).

This git config automatically directs all github https to ssh for me. It could be used somehow, but I think it's probably too complex / too fragile to recommend for general use.

[url "git@github.com:"]
        insteadOf = https://github.com/
bast commented 5 months ago

In the upcoming workshop we will try to work with: