qertnutrition.blogg.se

Setup private key smartgit ssh
Setup private key smartgit ssh






#Setup private key smartgit ssh windows#

In windows system variables, set GIT_SSH=plink (whereĪfter that, please use pageant and load the private key.Edit|Preferences|Commands|Authentication, choose Use System SSH.If you want to use putty as ssh client, please follow the below steps: Use the last file to authenticate in SmartGit.Save private key to use with SmartGit using menu voice Conversions/Export OpenSSH key.Save or copy the public key at your need.Optionally, enter a passphrase to protect your private key

setup private key smartgit ssh

To generate public/private key pair as needed by many git servers (like Assembla) use PuTTYgenĬlick on Generate and move your mouse until it tells you that the key is generated.On windows you can do the following procedure: I just want to go in details to help the ones starting from scratch: Ssh -o IdentitiesOnly=yes -i ~/.Needed to save my ssh private key as an OpenSSH key in PuTTYgen because SmartGit only understand that format. Ssh -o IdentitiesOnly=yes -i ~/.ssh/company-id ] then # bitbucket has weird urls Ssh -o IdentitiesOnly=yes -i "$key" ] then # use company id If you want to look at the repository remotes but have multiple remotes that need different keys, you can add remote="$1:$(sed "s.*, s,',g"&2.You can add git remote -v check to add heuristics based on the the remotes, like in Eike's script.This can be done in the else section so heuristics only kick in if there is no specific key in ssh.key.

setup private key smartgit ssh

  • As git executes core.sshCommand in the root directory of the repository, your custom git-ssh-command can look at that and have some heuristics about directory names.
  • Set the global ssh.key to have a "default fallback to non-default SSH key" or something.
  • setup private key smartgit ssh

    ( ~/.local/bin is the current standard for "place user scripts here" on SystemD operating systems)Īfter you set this up, you can configure any repository to use a specific SSH key by setting the configuration option ssh.key: git config -local ssh.key ~/.ssh/my-non-default-private-key Git config -global core.sshCommand ~/.local/bin/git-ssh-command Ssh -o IdentitiesOnly=yes -i "$key" set it up as the global git SSH command: chmod 755 ~/.local/bin/git-ssh-command For example, all my personal projects that need to my personal SSH key with Gitlab are under ~/Documents/Projects/personal so when the shell hook runs pwd and finds that the current directory is under that path, it automatically sets the GIT_SSH_COMMAND variables as needed.Īnother option is to write a small script to make core.sshCommand a bit smarter - check if the current working directory has a specific SSH key configured and if so use it, otherwise - rely on the standard SSH key resolution.

    setup private key smartgit ssh

    The workaround for me was to set up the session correctly with the environment variable GIT_SSH_COMMAND, like so: export GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -i ~/.ssh/my-secret-identitiy"Īnother thing to note here is that setting the environment variable correctly can be a hustle, so I'm using the command prompt modification facilities provided by things like Liquid Prompt or Fish Shell to hook into the shell and keep updating the environment variables according to the current directory and some rules. In my scenario, similar to Smith scenario (whose solution, BTW, didn't work for me), I need to use different keys for the same server under different repositories. : see my other answer for a configuration-based method with a ready-made script for you to use






    Setup private key smartgit ssh