Add a dialog to enter my username and password in addition to the CLI integration
AaronJWhite opened this issue ยท 19 comments
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.
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:
- git.exe needs to work with a remote host over the HTTPS protocol and invokes git-remote-https.
- git-remote-https negotiates with the host.
- The host rejects git-remote-https due to lack of credentials.
- git-remote-https fails with a reason code linked to credentials.
- git.exe invokes git-credential in hopes of acquiring useful credentials.
- git-credential scans Git's configuration to see if any helpers are registered.
- 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:
- git-credential finds that credential.helper=winstore and invokes git-credential-winstore with the "get" option.
- git-credential-winstore lacks credentials for the + and generates a modal dialog asking for credentials.
- 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:
- git-credential finds that credential.helper=manager and invokes git-credential-manager with the "get" option.
- git-credential-manager lacks credentials for the + .
- git-credential-manager looks at configuration + to determine if these are basic credentials, VSO m-factor, or GitHub 2-factor authentication.
- In the case of basic credentials, git-credential-manager tells git-credential the truth that it does not have any credentials for it.
- git-credential then prompts the user at the command line for credentials.
- The user enters credentials.
- git-credential invokes git-credential-manager with the store option and supplies the credentials for storage.
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:.
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 ๐
@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?
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!
@AaronJWhite thanks for the feedback, we'll take it to heart. ๐
- 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.
- 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.
- 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.
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.
Thanks. I love the tool.
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.
@macies What version of Git are you using?
#74 resolves the original issue.
The issue mentioned by @macies is likely the result of one, or more, of the following:
~/.gitconfig
does not containcredential.helper=manager
. You can check this by runninggit config --list
and looking for the line.$git/libexec/core-git/...
does not containgit-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 thecmd.exe
to see whichgit.exe
the OS is invoking when you invoke Git.
Thanks for the help! It was lack of 'credential.helper=manager' in the config. Added that and all is working fine.
@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
@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.
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.
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?
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