568

Configuration core.sshCommand (update 2021) Since Git version 2.10.0, you can configure this per repo or globally, so you don't have to set the environment variable any more! git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example -F /dev/null" git pull git push Environment variable GIT_SSH_COMMAND (old answer) From Git version 2.3.0, you can use ...


161

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: ...


68

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


43

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, ...


34

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 ...


27

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 '...


26

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 ...


24

If you need to connect to the same host with different keys then you can achieve it by: Configure the ~/.ssh/config with different Hosts but same HostNames. Clone your repo using the appropriate host. Example: ~/.ssh/config Host work HostName bitbucket.org IdentityFile ~/.ssh/id_rsa_work User git Host personal HostName bitbucket.org ...


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 ...


16

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


15

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 ...


14

For most browsers Log in with a nonsense user using the address bar. For example, if you logged on to http://codereview.internal.company and loaded the URL http://codereview.internal.company/r144, enter this: http://logout:logout@codereview.internal.company/r144 h/t Riyadi on tolaris.com For Chrome This used to worked on Chrome, but no longer. There might ...


13

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 ...


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

I've done this successfully with WinHTTrack. You can follow the normal procedure for capturing a website, with two minor settings tweaks: In Chrome, open Dev Tools, then login to the website you need to capture. In the Network tab, click on the HTML page you requested to find your session cookie (the name of this will differ depending on the back-end ...


12

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/...


11

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 ...


10

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 ...


9

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 ...


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.


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

The ssh client and the ssh-agent is communicating through a Unix domain socket whose name is specified to the client by the SSH_AUTH_SOCK environment variable (set by the agent upon its startup). Thus, to prevent a single invocation of the client from querying the agent this variable can be set explicitly to something invalid, like an empty string; $ ...


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

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).


8

There is no such thing as "SFTP key authentication", nor is there an "SFTP key" at all. SFTP always uses standard SSH as the transport – the differences only begin after you've suc­cess­ful­ly au­then­ti­cat­ed (the client then requests either an interactive session, or an 'sftp' subsystem session). In other words, SFTP works exactly the ...


7

I had a client that needed a separate github account. So I needed to use a separate key just for this one project. My solution was to add this to my .zshrc / .bashrc: alias infogit="GIT_SSH_COMMAND=\"ssh -i ~/.ssh/id_specialkey\" git $@" Whenever I want to use git for that project I replace "infogit" with git: infogit commit -am "Some message" &&...


7

This is pretty much impossible as ping works at a much lower level than the proxy. I am guessing you use a HTTP proxy – it works at a high level; the browser (or yum) only sends it HTTP requests for specific URLs (e.g. GET http://www.google.com/), and the proxy handles everything else – it might open a TCP connection to the server and forward the request; ...


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

I think, you misunderstood the usage of authorized_keys. authorized_keys is not a directory into which you put your pubkey-files. authorized_keys is a regular file which includes all your pubkeys. If you have only one key, you could just rename the file mv id_rsa.pub authorized_keys If you have more than one key, you could use cat to concatenate those ...


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