Store https passwords with cygwin's Git - windows

I am using Cygwin and Git. Every time I push/pull to a repo on Bitbucket with a https url I am asked to enter a password.
Is there a way to store these credentials (like with ssh-keys)?
I tried to install Windows Credential Store for Git but I can't get it to work with cygwin's Git.
Thanks!
Update:
I found my answer here: Is there a way to skip password typing when using https:// on GitHub?
Summarized:
Remember passwords for 15 minutes (default):
git config --global credential.helper cache
Remember passwords for 10 hours:
git config --global credential.helper 'cache --timeout=36000'
Store passwords (didn't try this):
git config --global credential.helper store
Reset:
git config --unset --global credential.helper
Cim

The way OP answered his own question is one way to go about it.
The Windows Credential Store project was discontinued in 2015. Its original author suggests to use Git Credential Manager for Windows, maintained by Microsoft. Their installer is focused on Git for Windows, however the program itself works well with Cygwin, you just have to install it manually.
Go the GCMW's latest release, download the zip file (not the installer), extract its contents (only .dll and .exe files are needed) to C:\cygwin\usr\libexec\git-core\ for 32-bit Cygwin, or C:\cygwin64\usr\libexec\git-core\ for 64-bit Cygwin. Reference
To get git to use GCMW, execute: git config --global credential.helper manager
To get GUI prompts for credentials, execute: git config --global credential.modalprompt true
If you want this to be a per-repository setting, remove the --global option.

I made Windows Credential Store working with cygwin. The only thing that needs to be changed is global ~/.gitconfig file.
Change 'helper' value which can be found usually at the end of the file to the following:
[credential]
helper = !'/cygdrive/C/Users/<YOUR-ACCOUNT-NAME>/AppData/Roaming/GitCredStore/git-credential-winstore.exe'
For an explanation, cygwin simply uses different paths and the value must follow the rules of course.

Related

Clear git-credential-manager-core cached login

Cannot clear the git-credential-manager-core cache
it always show the last user
Using Windows credentials Manager - no login regarding Git
Using the "Forget: option in Dialog not working
Using "Erase" in Git Bash Not clearing
Delete all Sign-In from Visual Studio
delete all "%LOCALAPPDATA%.IdentityService"
any help would be most appreciated
You should try at command line by git config --global --unset user.password.
Please let me know if it worked.
Regards.
Disable Git Credential Manager if you don’t use it.
git config --global --unset credential.helper
Do all above Steps - in original Question.
And also clean all content using Internet Explorer

Using git in windows over sshd - stuck in push

In my environment, I cannot log in to the Windows GUI, but I have to use sshd to get a console (cmd.exe) from windows server 2019. Git is installed, but as soon as I try to do a git push, I face a problem:
Usually, in a CMD Console in Windows, a window with the credential manager would pop up, which doesn't work for this use case, where I actually "ssh-ed" via putty to a windows server. It seems that git gets stuck, obviously wanting to open a window.
How can I turn off this behavior, and make git on Windows more "unix-ish", so that like in a Linux environment the username/password prompt appears on the console?
Try and disable the credential helper (in your SSH session)
git config credential.helper=
That will allow you to test if Git is asking for credentials on the command line instead of opening a popup.
Note that this is only if you are cloning HTTPS URL.
Alternative option:
cd path/to/repo
git config --system --unset credential.helper
git config --global --unset credential.helper
git config --unset credential.helper

How to prevent BitBucket credentials getting stored in Windows Credential Manager when using Visual Studio?

I can't stop my BitBucket credentials being stored in Windows Credential Manager when using Visual Studio.
I've unset credential.helper using all three commands:
git config --global --unset credential.helper
git config --system --unset credential.helper
git config --unset credential.helper
Interestingly, after running the above commands the credential.helper setting still shows manager within Visual Studio repository settings.
I've even tried disabling Credential Manager within Windows Services but all this does is prevent me from opening Credential Manager. The credentials are still getting stored!
I've also tried setting credential.helper to cache --timeout=600 hoping that the credentials would be forgotten after 10 minutes. But still the credentials are stored, and remembered after 10 minutes.
Couldn't find a way of doing it so now I just use Git Bash instead.
I need to do this as I'm using a shared virtual machine and can't have my personal credentials stored there.

Git config values clash

I ran into big git configuration problem on my windows laptop. I downloaded Git for Desktop since I wasn't able to install git lfs to my cygwin git. I then removed the git from cygwin. I have a GitHub project which is using git-lfs for storing
large files. When I clone the project and it starts downloading files from the remote server it says:
WARNING: These git config values clash:
git config "http.sslcainfo" = "C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt"
git config "http.sslcainfo" = "/ssl/certs/ca-bundle-ghfw.crt"
Neither of those file locations exist on my computer. When I use git config --list I can see both values for http.sslcainfo. But the mingw one is not listed in with any of the git config --system --list, git config --global --list or git config --local --list. So I can't locate the file where
configuration is. I assume the Git for Desktop wants to use the /ssl/certs/ location since it sets it to git config --system when it is installed. I also have installed mingw on my computer but I couldn't find .gitconfig file inside it. Also I don't know why git would even look from there or where the configurations might be saved. I'm able to clone repository which doesn't use git-lfs. So is there any way to remove the http.sslcainfo = "C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt" configuration? Any help will be highly appreciated.
first of all, i have to tell you that im not sure if i can help you. However, i want to share my information with you.... maybe it helps. I am tying out git-lfs for some big repos at the moment. I am using the bitbucket test server. Atleast on bitbucket, they say that files from git lfs are downloaded via HTTPS and need an ssl cert.
I hope that this helps you a bit. If you got more questions about this, feel free to ask.
Frossy

How to make git reset previous credentials on OS X?

I'm a Git instructor, so must have multiple GitHub accounts for demonstration purposes. I'm using Git on both Ubuntu, Windows and sometimes in OS X.
I have a problem in OS X where Git remembers the previous credentials. According to the screen shot, I want to push a testing repository to GitHub account of jeud, but Git remembers the credentials of account tutor4dev, so Git never prompts me for any authentication like I would get when using Ubuntu and Windows.
I have tried git config credential.https://github.com.jeud jeud, but it's still not working.
Please guide what to do, thanks.
Edited
In my case, I can reset the current username and password using /Applications/Utilities/Keychain Access
But if possible, I would like Git to prompt me for authentication every time when github.com requires for credential.
I have removed the credential helper using git config --global --unset credential.helper and setup core.askpass using git config --global core.askpass true, but Git still uses the username and password stored in the OS.
I have solved my problem by deleting existing credential on my machine using /Applications/Utilities/Keychain Access
Try using:
git config --global --edit
That should show you the contents of .gitconfig located at:
~/.gitconfig

Resources