453

Environment variable GIT_SSH_COMMAND: From Git version 2.3.0, you can use the environment variable GIT_SSH_COMMAND like this: GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example" git clone example Note that -i can sometimes be overridden by your config file, in which case, you should give SSH an empty config file, like this: GIT_SSH_COMMAND="ssh -i ~/.ssh/...


135

There is no direct way to tell git which private key to use, because it relies on ssh for repository authentication. However, there are still a few ways to achieve your goal: Option 1: ssh-agent You can use ssh-agent to temporarily authorize your private key. For example: $ ssh-agent sh -c 'ssh-add ~/.ssh/id_rsa; git fetch user@host' Option 2: ...


101

Up to GnuPG 2 The user configuration (in ~/.gnupg/gpg-agent.conf) can only define the default and maximum caching duration; it can't be disabled. The default-cache-ttl option sets the timeout (in seconds) after the last GnuPG activity (so it resets if you use it), the maximum-cache-ttl option set the timespan (in seconds) it caches after entering your ...


42

The SSH protocol has numerous authentication methods. The password and keyboard-interactive are two of them. The password authentication is a simple request for a single password. There's no specific prompt sent by the server. So it's the client that chooses how to label the prompt (The "user@host's password" prompt is from the OpenSSH clients, like ssh, ...


37

Try: sftp -o "IdentityFile=keyname" jay@server.name.com You can use -o to pass any option that's valid in ~/.ssh/config.


32

Use custom host config in ~/.ssh/config, like this: Host gitlab-as-thuc HostName github.com User git IdentityFile ~/.ssh/id_rsa.thuc IdentitiesOnly yes then use your custom hostname like this: git remote add thuc git@gitlab-as-thuc:your-repo.git


25

I generally do it like so: $ ssh -o IdentitiesOnly=yes -F /dev/null -i ~/path/to/some_id_rsa root@server.mydom.com The options are as follows: -o IdentitiesOnly=yes - tells SSH to only use keys that are provided via the CLI and none from the $HOME/.ssh or via ssh-agent -F /dev/null - disables the use of $HOME/.ssh/config -i ~/path/to/some_id_rsa - the key ...


24

If you do not want to have to specify environment variables every time you run git, do not want another wrapper script, do not/can not run ssh-agent(1), nor want to download another package just for this, use the git-remote-ext(1) external transport: $ git clone 'ext::ssh -i $HOME/.ssh/alternate_id git.example.com %S /path/to/repository.git' Cloning into '...


21

Natively, it should work - though SE uses a lot of modern stuff on their website, and obviously it isn't working for you or terdon, as per the comments. However there's a site called column 80 ( stackapps link ) that might let you read, SOFU and other sites on SE. That said, a terminal accessible SE chat would be ace ;). This question looks like this on w3m


17

After my struggle with $GIT_SSH I would like to share what worked for me. Through my examples I will assume you have your private key located at/home/user/.ssh/jenkins Error to avoid: GIT_SSH value includes options $ export GIT_SSH="ssh -i /home/user/.ssh/jenkins" or whatever similar will fails, as git will try to execute the value as a file. For that ...


15

To automatically authenticate, add the /savecred flag. You'll have to enter the password on the script's first run, but it will be saved after that. Realize that runas will then be able to use the saved credentials to execute any given program, so do think about how that could be a security issue before going this route. Your usage is correct though, just ...


15

For Windows The file you need to edit should be placed at: ~\.gnupg\ If you run that in a PowerShell window it will open: C:\Users\<UserName>\.gnupg Just put the gpg-agent.conf file there with whatever values you like. You can verify it took by running: gpgconf.exe --reload gpg-agent gpgconf.exe --list-options gpg-agent You can also use this one ...


15

Two-factor auth generally doesn't work per machine – it works per client. When you log in to GitHub using a web browser, it's the web browser that remembers cookies with both the auth info, and the 2FA status. git does not know about that. To push over HTTP(S), you will need to generate a secondary password ("personal access token") in GitHub's application ...


14

In the scenario where you have many keys, you will invariably run into the "Too many Authentication Failures" error. If you have a password, and want to simply use the password to login, here is how you do it. To use ONLY password authentication and NOT use Public-key, and NOT use the somewhat misleading "keyboard-interactive" (which is a superset ...


13

Some SSL certificates have expired in your eCatcher. You should either download new certificates from the eWON web site (eCatcher 4.x only). Or better still, you should upgrade to the latest version. This page on the eWON web site contains the links to address your problem. (Disclaimer: I am a member of the eWON R&D team.)


12

Log in with a nonsense user using the address bar. For example, if you logged on to http://codereview.internal.company, enter this: http://logout:logout@codereview.internal.company h/t Riyadi on tolaris.com


11

Make sure to reload your gpg agent with gpg-connect-agent reloadagent /bye after changing the config.


11

If you just want to implement your own way of checking the entered password, then write a PAM module. It is a simple .so library that contains a pam_sm_authenticate() function. (It can also provide functions for authorization, password-change, etc.) Start with something like this (in C), compile it as a .so library using -shared, copy to /lib/security/...


10

Use IdentityFile but Keep Using ssh-agent to Avoid Passphrase Reprompts The accepted solution of using IdentitiesOnly yes means you'll never be able to take advantage of ssh-agent, resulting in repeated prompts for your passphrase when loading your key. To keep using ssh-agent and avoid the 'Too many authentication failures' errors, try this: Remove any ...


9

In example A you would be referring to the Domain Administrator (if you had one). In example B you would be referring to the local Administrator account on the specific PC.


9

I'm not sure if this is the proper solution but noticed in the SSSD FAQ this point: When should I enable enumeration in SSSD? or Why is enumeration disabled by default? "Enumeration" is SSSD's term for "reading in and displaying all the values of a particular map (users, groups, etc.)". We disable this by default in the SSSD in order to minimize ...


8

If you are on Mac OS X and you are wondering how to remove a basic-authentication credential from a website, you won't find the password in Safari preferences. The answer is in the Keychain Access App. Open it up (it's in Utilities) and then go to the Passwords Category (the categories are on the left, at the bottom - you don't need to be doing anything ...


8

I added to ~/.ssh/config this: Host * IdentitiesOnly yes It enables option IdentitiesOnly=yes by default. If you'll need to connect with private key, you should specify it with option -i


8

I ran into this same problem just now and the help button on the share dialog actually (lo and behold) gave useful information: Go to Control Panel -> Network and Internet -> Network and Sharing Center -> Advanced sharing settings and change Password protected sharing to off. See picture below:


8

Windows will cache your account information locally once you login to the machine once. If the next time you try to login the DC can't be reached it will use the cached settings. This might be useful for laptops which might be needed to work off the network. About the security issues, when you logon to Windows by using cached logon information, if the ...


8

It is possible to do this by chaining together PAM modules. But before I get into any details: Incorrectly configuring PAM can and WILL prevent you from logging into your system Thankfully you can always boot up into single user mode and fix the problem, but just be warned that PAM is not something you want to mess with more than necessary. Anyway, the ...


7

So I set the GIT_SSH env variable to $HOME/bin/git-ssh. In order to support having my repo configuration dictate which ssh identity to use, my ~/bin/git-ssh file is this: #!/bin/sh ssh -i $(git config --get ssh.identity) -F /dev/null -p 22 $* Then I have a global git config setting: $ git config --global ssh.identity ~/.ssh/default_id_rsa And within any ...


7

You're looking for Windows 8's Picture Passwords. You can choose any picture as a background, then record arbitrary gestures and swipes to log in with. To set it up, go to the Users section of PC Settings and click Create a picture password.


7

I've been trying to troubleshoot this problem for nearly seven years, and finally it get solved -- I launch keychain in my ~/.profile, which starts its own 'ssh-agent', even on machine B & C. This is the source of the problem, because keychain's ssh-agent overshadow the sshd provided one. Removing it (keychain) from my ~/.profile solved the problem. ...


7

You can do this with the --location-trusted option: allow sending the name + password to all hosts that the site may redirect to. The libcurl option for this is CURLOPT_UNRESTRICTED_AUTH and it is available from curl version 7.10.4-pre6 (31 Mar 2003).


Only top voted, non community-wiki answers of a minimum length are eligible