In this article i will explain how you can run git clone command on a machine without having to accept sh key finger prints manually.
Lets you want to write a script to initialise a developer machine, which require you to git clone various projects from gitlab or github or any other git repo.
First time you run a git clone command, it will ask you if you accept the signature and it need to be part of automated script, its not nice thing to have.
Here is the solution.
Lets you want to write a script to initialise a developer machine, which require you to git clone various projects from gitlab or github or any other git repo.
First time you run a git clone command, it will ask you if you accept the signature and it need to be part of automated script, its not nice thing to have.
Here is the solution.
- First you download the git host's key
- then create its finger print
- then check this finger print against known valid finge rprint
- If its good then move downloaded ssh key to ~/.ssh/known_hosts file
- else throw error
ssh-keyscan github.com >> githubKey ssh-keyscan gitlab.com >> gitlabKey export githubfinger=$(ssh-keygen -lf githubKey) export gitlabfinger=$(ssh-keygen -lf gitlabKey) echo $githubfinger echo $gitlabfinger if [[ $githubfinger == *"nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8"* ]]; then echo "Github Key check succesfull" cat githubKey >> ~/.ssh/known_hosts else echo "Github key check failed" exit 1 fi if [[ $gitlabfinger == *"ROQFvPThGrW4RuWLoL9tq9I9zJ42fK4XywyRtbOz/EQ"* ]]; then echo "Gitlab Key check succesfull" cat gitlabKey >> ~/.ssh/known_hosts else echo "Gitlab key check failed" exit 1 fi rm -f githubKey rm -f gitlabKey
The Casino At Mohegan Sun, Uncasville, CT Hotel - MapYRO
ReplyDeleteHotel deals 경산 출장마사지 at 구리 출장샵 Mohegan Sun in Uncasville, CT. Find deals and discounts for 태백 출장샵 AAA/AARP members, seniors, long stays 정읍 출장샵 & military. 안동 출장안마