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.
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.
Laravel 8 queue and job example tutorialIn the previous article, we have discuss...
How to Abort Ajax Requests using jQuerySometimes you might want to cancel the a...
How to get Minimum Value Key in Associative Array in PHPToday we will share with you one simple...
How to Compress and Optimize Image before Uploading in Laravel 8Since performance is by and astronomical...