Using git in windows over sshd - stuck in push - windows

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

Related

Problem with git proxy work only few minutes after reboot of windows

I have some problem with git proxy on my company' laptop.
I added environment variables HTTP_PROXY, HTTPS_PROXY and a FTP_PROXY in system variables.
After reboot my git works fine for some minutes everything is fine - push work and I can pull everything.
But after few minutes of laptop working I face error:
Push failed unable to access 'https://gitlab.****.com/**/**/': Proxy CONNECT aborted
I do not know what to do I have already tried to unset git config variables as http.proxy, https.proxy but it does change nothing.
When I face this error I perform computer reboot and I am able to push or pull and the error message does not appear[ but only for just a few minutes !].
System: Windows
VPN: turned ON
Git reinstall does not help.
The error occurs in cmd and in PyCharm.
Git user.name and user.email are correct.
I also tried to use http.proxy and https.proxy as http://login:pwd#server:port and it does change nothing.
Please help me, thanks and best regards.
Solution:
reinstall git
set credential.helper to manager-core in ../Git/etc/gitconfig
set environment variables to small letters ftp_proxy, http_proxy, https_proxy and use the same 'http://' prefix for each of them
remove all windows credentials with git: preffix,
remove http.proxy from git config --global -l, --system and --local
add windows credential ( generic) for https://gitlab.domain.com
If did not work reinstall windows and try once again.

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.

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

Store https passwords with cygwin's Git

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.

Git instaweb: The browser is not available

I'm trying to setup git instaweb to open in Chrome. I have set the default browser like so:
git config --global web.browser chrome
This change is reflected in my global .gitconfig, and the git-web--browse documentation says that chrome is available as something to pass in.
When I run git instaweb this is what I get:
The browser chrome is not available as 'chrome'.
http://127.0.0.1:1234
I have also tried google-chrome and the same results happen. How can I set the web browser to actually open in chrome?
Running OSX 10.8.2
Maybe it needs a solution similar to How can I configure git help to use Firefox?:
git config --global web.browser ch
git config --global browser.ch.cmd "open -a Google Chrome.app"
The OP MishieMoo reports you need the full path:
git config --global browser.ch.cmd "open -a \"/Applications/Google Chrome.app\""
Without the absolute path, it was trying to open Chrome.app in my current directory (which was not Applications)

Resources