Skip to main content

How to git without finger print confirmation

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.

  • 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 >> githubKey
ssh-keyscan >> 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
  echo "Github key check failed"
exit 1

if [[ $gitlabfinger == *"ROQFvPThGrW4RuWLoL9tq9I9zJ42fK4XywyRtbOz/EQ"* ]]; then
  echo "Gitlab Key check succesfull"
  cat gitlabKey >> ~/.ssh/known_hosts
  echo "Gitlab key check failed"
exit 1

rm -f githubKey
rm -f gitlabKey


  1. The Casino At Mohegan Sun, Uncasville, CT Hotel - MapYRO
    Hotel deals 경산 출장마사지 at 구리 출장샵 Mohegan Sun in Uncasville, CT. Find deals and discounts for 태백 출장샵 AAA/AARP members, seniors, long stays 정읍 출장샵 & military. 안동 출장안마


Post a Comment

Popular posts from this blog

How to add custom user attributes in keycloak and access them in spring boot application

Sometime it may be possible you want to add more parameters to standard registration page of keyloak for your users and aaccess that data in your spring boot application. This artical will show step by steps on how to add such extra attributes. What is Keycloak Keycloak is an open source software product to allow single sign-on with Identity Management and Access Management aimed at modern applications and services, to learn more visit  h ttps:// What is Spring boot Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". To learn more visit To add an extra attribute in keyclkoak server you will need to edit actuall html template and then registaer new attribute in json response so that it will be available on client. Edit HTML template Lets assume we want to add mobile number on default registration page. Go to Keycloak home installation directory edit fil

How to create java maven project in intelij

Open intellij Create a new java maven project in intellij . Select Maven type, Select JDK you want to use and click Next. Enter GroupId and ArtifactId, click Next Select project Location and click finish Intelij will display a warning, just press Ok. Once project is created , a popup may appear asking for auto import, select "Enable Auto Import" You will have a project created, looking something like this Note: I have created these instructions using, Instruction for other OS or intellij Version shouldn't be much different, if you need instruction for other version leave a comment and i will try to come up with another set of instructions. Intellij 2017.2.1 Java 1.8 Mac OS