Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Add a dialog to enter my username and password in addition to the CLI integration #31

Closed
AaronJWhite opened this issue Oct 7, 2015 · 19 comments
Assignees
Labels
documentation Related to documentation. enhancement Indicates general improvement or new feature. question

Comments

@AaronJWhite
Copy link

The old "git-credential-winstore" would bring up a user/pass dialog on the first connection to a git host it didn't have the credentials for. The user entered the credentials into the dialog that first time and then the git-credential-winstore would reuse the credentials for all connections after that.
I'm not getting a dialog for this when trying to connect using this credential helper. Can you include some type of documentation on how to store credentials with this in the readme? Or maybe a screenshot of what I should see.

@whoisj
Copy link
Contributor

whoisj commented Oct 7, 2015

Thanks for the question. 😄

The model dialog presented by git-credential-winstore was a work around for the case when it did not have credentials stored. With git-credential-manager we use Git's native credential flow.

TL;DR
Enter your username and password at the command line when prompted. Your credentials will get stored securely and reused in future interactions.

I'll see about getting a "how does this thing actually work?" section added to the README.md.

Let's look at Git's native flow:

  1. git.exe needs to work with a remote host over the HTTPS protocol and invokes git-remote-https.
  2. git-remote-https negotiates with the host.
  3. The host rejects git-remote-https due to lack of credentials.
  4. git-remote-https fails with a reason code linked to credentials.
  5. git.exe invokes git-credential in hopes of acquiring useful credentials.
  6. git-credential scans Git's configuration to see if any helpers are registered.
  7. git-credential invokes the helpers one at a time in the order listed in hopes of one having useful credentials for the + values.

Here is where Git Credential WinStore and Git Credential Manager differ

Winstore flow:

  1. git-credential finds that credential.helper=winstore and invokes git-credential-winstore with the "get" option.
  2. git-credential-winstore lacks credentials for the + and generates a modal dialog asking for credentials.
  3. User enters credentials and git-credential-winstore stores them. Since empty credentials are valid credentials, the user will never see another prompt but could see an auth failure.

Manager flow:

  1. git-credential finds that credential.helper=manager and invokes git-credential-manager with the "get" option.
  2. git-credential-manager lacks credentials for the + .
  3. git-credential-manager looks at configuration + to determine if these are basic credentials, VSO m-factor, or GitHub 2-factor authentication.
  4. In the case of basic credentials, git-credential-manager tells git-credential the truth that it does not have any credentials for it.
  5. git-credential then prompts the user at the command line for credentials.
  6. The user enters credentials.
  7. git-credential invokes git-credential-manager with the store option and supplies the credentials for storage.

@whoisj whoisj added enhancement Indicates general improvement or new feature. question documentation Related to documentation. labels Oct 7, 2015
@AaronJWhite
Copy link
Author

Hi whoisj,

Thanks for the quick reply! Looks like I have it working in my environment now.
Also, instead of adding the user/pass through the command prompt can I just add the credentials directly to the windows credential manager? Just have to prefix the host with git:.

@whoisj
Copy link
Contributor

whoisj commented Oct 9, 2015

can I just add the credentials directly to the windows credential manager? Just have to prefix the host with git:.

Yes, that'll work fine 😄

@jeremyepling
Copy link
Contributor

@AaronJWhite You can add them directly, but having them automatically added via the Git command line is much easier. Is there a reason you don't like that experience? Are you running a build agent?

@AaronJWhite
Copy link
Author

TL;DR - I'm lazy and use simple git functions. I'm not trying to remember git syntax/commands if I don't have to. With the old credential-manager I didn't have to remember anything.

Hi @jeremyepling ,
I'm not running a build agent, but I really don't have a reason to use git directly either. I use git primarily through my development tools (mainly SublimeText) and the git plugin handles all of the complexity of remembering git commands. This lets me focus on what I am developing. The nice thing about the other credential manager was that you after you installed it (by just clicking the .exe file) you could go use your dev tools and if a password was needed you get the prompt one time and it seemingly disappeared forever. I enjoy git, hell I setup my own git server for private projects, but I'm still not a power user that feels the need to remember git commands for complex features or touch git directly at all. It would be nice if there was an option to enable the prompt like the old credential store for users like me, but adding my credentials directly to the windows credential store is ok too for now.

Thanks for your help and work on this project!

@whoisj
Copy link
Contributor

whoisj commented Oct 9, 2015

@AaronJWhite thanks for the feedback, we'll take it to heart. 😄

@whoisj whoisj closed this as completed Oct 9, 2015
@AndrewPardoe
Copy link

  1. It would have been nice to know that there was a change in the way this works. I reinstalled this package three times, restarted my shell, etc., not able to figure out why the dialog wasn't popping up.
  2. Although I use Git from the command line I've always used the credential manager. It took me a minute too long to realize that "authcode:" was looking for two factor authentication. This bad UI isn't actually your fault but I'm your user and I was confused.
  3. I don't know whether cutting and pasting into a git command-line login actually works. When I hit Edit->Paste in the console, nothing appears (such as stars or dots or even clear text.) So I cancel that login and do it again, this time typing my long, secure password out of my password manager. The UI definitely took--and acknowledged--cut and paste input.

In summary, it would be nice to have a step during install where I just add my credentials. That way I'd know that you silently changed the UI.

@whoisj
Copy link
Contributor

whoisj commented Nov 13, 2015

We do plan to resolve this. I've just been under a pile of workload on another project.

Once I'm out from under that, I'll come back here and fix up a bunch of these open request.

I'll re-open this just to make sure it doesn't get lost.

@whoisj whoisj reopened this Nov 13, 2015
@AndrewPardoe
Copy link

Thanks. I love the tool.

@ghost
Copy link

ghost commented Nov 24, 2015

I have just installed the tool. Trying to use either GIT Bash (in MINGW32 console)or TortoiseGIt UI. Both keep prompting me for username and password each time I use a command. I have a remote VSO repo and I have created a token for login from command line. I pass in the token and that works, however nothing gets stored anywhere and I have to pass it in for each command.

What am I missing? Some documentation would be really helpful here.

@jeremyepling
Copy link
Contributor

@macies What version of Git are you using?

@jeremyepling jeremyepling changed the title What are the ways to store credentials with this? Add a dialog to enter my username and password in addition to the CLI integration Nov 25, 2015
@whoisj
Copy link
Contributor

whoisj commented Nov 25, 2015

#74 resolves the original issue.

The issue mentioned by @macies is likely the result of one, or more, of the following:

  • ~/.gitconfig does not contain credential.helper=manager. You can check this by running git config --list and looking for the line.
  • $git/libexec/core-git/... does not contain git-credential-manager.exe, you can use Windows Explorer to check on that.
  • The instance of Git that you're using, it not the instance of Git that you think that you're using. You can use where git from the cmd.exe to see which git.exe the OS is invoking when you invoke Git.

@whoisj whoisj closed this as completed Nov 25, 2015
@ghost
Copy link

ghost commented Nov 25, 2015

Thanks for the help! It was lack of 'credential.helper=manager' in the config. Added that and all is working fine.

@ahmad2x4
Copy link

ahmad2x4 commented Jan 5, 2016

@whoisj I am using git version 2.6.4.windows.1 and the credential.helper=manager is set but it keeps prompting oauth flow twice and the ask for basic authentication. Despite successful login (I can see refresh token and access token when I intercept the request) manager does not save anything and it keeps asking for authentication

@whoisj
Copy link
Contributor

whoisj commented Jan 5, 2016

@ahmad2x4 in a previous version, Git for Windows, had an issue with their installer where the binaries ended up in users' personal folders (instead of the system folder: Program Files). With version 2.6.4.windows.1 the issue was remedied with the result of many plugins not being carried forward.

I suggest reinstalling the GCM. That will place the binaries in the correct location for Git to find them.

@DavidIQ
Copy link

DavidIQ commented Jan 5, 2016

Is there a way to force the credentials to be asked for again? I know I can go into the Credential Manager and delete the account but was wondering if there's something on the command line for that instead. Just had to change my network password, which affected my connection to our GitLab instance, so just wondering if there's a way.

@whoisj
Copy link
Contributor

whoisj commented Jan 5, 2016

Is there a way to force the credentials to be asked for again?

Today, no; but it does seem like a useful feature.

@DavidIQ can you open a request?

@DavidIQ
Copy link

DavidIQ commented Jan 5, 2016

Done. #99

@georgestevens99
Copy link

I have spent several hours trying to deal with credential problems. I have the GitHub Desktop utility installed and it has a super easy to use credential setting UI. Launch GitHub Desktop then File>Options will take you to the Accounts (and other tabs) dialog box which is simple and intuitive and easy to use.
Thanks,
George

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Related to documentation. enhancement Indicates general improvement or new feature. question
Projects
None yet
Development

No branches or pull requests

7 participants