Prevent Git from Popping Up Gnome Password Box

Prevent git from popping up gnome password box

It seems like git is probably using the GIT_ASKPASS or SSH_ASKPASS environment variables to figure out if it should use a separate program to prompt for passwords.

Try running unset GIT_ASKPASS or unset SSH_ASKPASS. Now try pushing or pulling from a git repository. If that works, add the appropriate command to .bashrc, .zshrc, or whatever file you use to run a command when your shell starts.

You can also override the value of git's core.askpass setting with git config --global core.askpass YOUR_PREFERRED_PROMPT_COMMAND.

Relevant information from the git-config man page:

core.askpass

Some commands (e.g. svn and http interfaces) that interactively ask for a password can be told to use an external program given via
the value of this variable. Can be overridden by the GIT_ASKPASS
environment variable. If not set, fall back to the value of the
SSH_ASKPASS environment variable or, failing that, a simple password
prompt. The external program shall be given a suitable prompt as
command line argument and write the password on its STDOUT.

Original source: http://kartzontech.blogspot.com/2011/04/how-to-disable-gnome-ssh-askpass.html

gitahead - HTTPS Credentials keeps popping up

Following worked for me.

On GitAhead click on the gear icon on your repository or go to repository > Configure repository. Then click on "Edit config File"

Add password by adding a colon at the end of the username/email

https://<USERNAME>:<PASSWORD>@github.com

Should be like this

[remote "origin"]
url = https://<USERNAME>:<PASSWORD>@github.com/{username}/{repo_name}.git
fetch = +refs/heads/*:refs/remotes/origin/*

Never use your account password. Use "personal access token" as the password, if you don't have it you can generate it in Github. Have a expiry date so that it will be safe, or you can generate one without expiration, your choice.

https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

Same thing applies to bitbucket as well.

https://<USERNAME>:<PASSWORD>@bitbucket.org/{username}/{repo_name}.git

Disable enter passphrase for each commit

default-cache-ttl
max-cache-ttl

This is the correct way to do this. The default timeout there is 10 minutes so if there are more then 10 minutes between your commits you would have to extend the time.

C:\Users\SashaChernykh.gnupg\gpg-agent.conf

This is not the correct path. This would be the path on a GNU/Linux system.

The Home directory for GnuPG on Windows is %APPDATA%\gnupg

e.g.

c:\Users\SashaChernykh\Appdata\Roaming\gnupg\gpg-agent.conf

After changing it you also have to restart the gpg-agent process.

You can do this by using gpgconf on the command line.

gpgconf --reload gpg-agent

The simplest way to change the value with Gpg4win and check that it was really set is by using Kleopatra:

Settings -> Configure Kleopatra -> GnuPG System -> Private Keys

There you can view the settings of and change:

expire cached PINs after N seconds
set maximum PIN cache lifetime to N seconds

To some high value.


If you don't want to have ever enter a passphrase you can simply remove it from your key.

On the command line:

gpg --passwd <yourkeyid or email>

You can leave it empty and will be asked two times to confirm that you want to leave it empty. Afterwards the passphrase of you key is removed and you do not have to enter the passphrase ever again.

You can also select change passphrase from Kleopatra's Details Window (double click on the key).

Gnome 3 Disable Unlock private key modal GUI

echo "pinentry-program /usr/bin/pinentry-gtk" >> ~/.gnupg/gpg-agent.conf
gpg-connect-agent reloadagent /bye

Almost solved.

Error when using Git credential helper with gnome-keyring as Sudo

I sometimes need to run sudo git clone since sometimes the directory where I need to make a clone requires it. Any help would be appreciated

The folder in which you try to clone the repository into was created by root so you dont have permission to write or to create folder under it unless you are root (sudo), set the permissions (chmod or chown) and you will be able to clone into the folder.

chmod 755 /path

Git push requires username and password

A common cause is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking "Clone or download", then clicking the "Use SSH" button above the URL field and updating the URL of your origin remote like this:

git remote set-url origin git@github.com:username/repo.git

You can check if you have added the remote as HTTPS or SSH using:

git remote -v

This is documented at GitHub: Switching remote URLs from HTTPS to SSH.

How can I save username and password in Git?

Attention: This method saves the credentials in plaintext on your PC's disk. Everyone on your computer can access it, e.g. malicious NPM modules.

Run

git config --global credential.helper store

then

git pull

provide a username and password and those details will then be remembered later. The credentials are stored in a file on the disk, with the disk permissions of "just user readable/writable" but still in plaintext.

If you want to change the password later

git pull

Will fail, because the password is incorrect, git then removes the offending user+password from the ~/.git-credentials file, so now re-run

git pull

to provide a new password so it works as earlier.

git produces Gtk-WARNING: cannot open display

I have finally discovered a solution to the problem. As it was described here, I ran the following command in the terminal:

  unset SSH_ASKPASS

and then running git push origin master works the way it should. You can also add the line to your .bashrc file.



Related Topics



Leave a reply



Submit