I have a remote repository which is Git. I want to connect to Git over ssh because there are problems with the firewall rules in our work environment. How can use ssh to connect remotely to Git with specifying ssh keys for this Git operations.
ssh-agent $(ssh-add /home/ismail/ssh_keys/ismail; \
git clone email@example.com:ibaydan/dev.git)
ssh-agent will create and temprorary environment where tkey is added with ssh-add command into the shell. After environment is completed git operations can be done where git will use current ssh keys to connect remotely with ssh tunnel. Keep in mind the keys will be lost after commands are completed
With Host Configuration
Another way to connect remote Git Repository over ssh is using ssh configuration files to specify IdentityFile like below
This will work too. When connecting to github.com specified IdentityFile will be used by ssh.