When you run git or ssh commands, it will first look ssh key from ~/.ssh folder. This is default folder ssh get keys from.
While working with multiple git clients, you might need to use different SSH keys for different clients.
In this article, we will discuss how to use specific SSH key. There are ways you can do it. We will discuss on them one by one.
By default, SSH will search for ~/.ssh/config file. So we will create file using nano command.
nano ~/.ssh/config
In this file, we will create alias for specific client.
Make sure you have enough permission for the file. Else you can change file permission with chmod command.
sudo chmod -R 600 ~/.ssh/github/id_rsa
Now you can use git commands like:
git clone https://github.com/laravel/laravel.git
The second option is to use GIT_SSH_COMMAND
environment variable. This will use specific ssh key instead of default key.
ssh-agent bash -c 'ssh-add ~/.ssh/github/id_rsa; git clone https://github.com/laravel/laravel.git'
I hope it will help you.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Laravel 8 queue and job example tutorial
In the previous article, we have discuss...How to Check If an Object Property is Undefined in JavaScript
Use the strict equality operator (===)...How to Abort Ajax Requests using jQuery
Sometimes you might want to cancel the a...How to get Minimum Value Key in Associative Array in PHP
Today we will share with you one simple...How to Compress and Optimize Image before Uploading in Laravel 8
Since performance is by and astronomical...