How to add ssh path to git command terminal

The fact is, I donโ€™t have root permissions on the remote server, and I canโ€™t use the default ssh location because of the same problem, even if they are OFF LIMITS for the user I'm currently using.

I found out that I can create ssh in a user folder, now I cannot find a way to transfer this to git. To be clear, I cannot edit the configuration file, and I cannot use any root commands.

It may be something like git -i ssh/path , but I can not find any documentation on this issue, since all I know is that it may not even be possible.

If someone found a solution to this, any guidance would be greatly appreciated!

EDIT: SOLUTION

Git clone with custom SSH using GIT_SSH error

+4
source share
2 answers

Use the GIT_SSH environment variable to change the ssh command that Git uses and specify the path to the private key file:

GIT_SSH='ssh -i /home/user/id_rsa'

+3
source

From the Atlassian How-to reference located here:

https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html

  • Open a terminal window and type ps -e | grep [s] sh-agent to find out if the agent is running.

     $ ps -e | grep [s]sh-agent 9060 ?? 0:00.28 /usr/bin/ssh-agent -l 
  • If the agent is not running, start it manually using the following command:

     $ ssh-agent /bin/bash 
  • Download the new credentials to the ssh-agent management program using the ssh-add command.

     $ ssh-add ~/.ssh/id_rsa 
  • Enter the passphrase for / Users / emmap 1 / .ssh / id_rsa:

     $ Identity added: /Users/emmap1/.ssh/id_rsa (/Users/emmpa1/.ssh/id_rsa) 
  • Use the ssh-add command to display the keys that the agent manages.

     $ ssh-add -l 2048 7a:9c:b2:9c:8e:4e:f4:af:de:70:77:b9:52:fd:44:97 /Users/manthony/.ssh/id_rsa (RSA) 

Hope this helps ...

+2
source

Source: https://habr.com/ru/post/1501535/


All Articles