{"id":1990,"date":"2021-07-21T13:38:38","date_gmt":"2021-07-21T13:38:38","guid":{"rendered":"https:\/\/gitprotect.io\/blog\/?p=1990"},"modified":"2025-06-13T08:29:42","modified_gmt":"2025-06-13T08:29:42","slug":"how-to-clone-using-ssh-in-git","status":"publish","type":"post","link":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/","title":{"rendered":"How to Clone Using SSH in Git?"},"content":{"rendered":"\n<p>Each of us is aware of the importance of security in the IT world. On the other hand, it turns out that not everyone uses appropriate security measures, or sometimes we just don&#8217;t know how to do it. And this is what you will learn from this article &#8211; what is SSH, ssh command, github ssh key, public ssh key, and ssh directory, and more to use in our Git repositories. I also encourage you to read this article: <strong><a href=\"https:\/\/gitprotect.io\/blog\/how-to-clone-a-git-repository\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to clone a repository<\/a><\/strong>. It explains the principles of <em>clone <\/em>operation and further reading will be easier if you first understand the basics and the idea of cloning.<\/p>\n\n\n\n<!--more-->\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-ssh\"><strong>What is SSH?<\/strong><\/h2>\n\n\n\n<p>First, we need to know what SSH is to understand why we can clone repositories with it. <strong>Secure SHell SSH is a communication protocol that enables a remote terminal connection<\/strong>, e.g. with a server or another computer. Importantly, such connections are encrypted. To establish such a connection, we need a pair of keys: private (saved on our computer&#8217;s hard drive) and public, shared with the service we want to connect to. We can quite easily establish such a connection for GitHub, GitLab, and Bitbucket. Also, the principle of operation is very similar on each of these portals, so I will focus only on GitHub ssh keys today as after that article you will be able to handle this process for other services on your own.<\/p>\n\n\n\n<p>Before we try to do this, we first need to generate the aforementioned pair of keys. Unix systems have a built-in SSH module, while Windows, unfortunately, does not. In this case, we need to git config ssh key and install some external tool that will enable us to work with this protocol. I will show you how to do it using this project: <a href=\"https:\/\/gitforwindows.org\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\"><strong>gitforwindows.org<\/strong><\/a><strong>. <\/strong>It allows you to use the terminal on Windows systems in the same way as in the Unix system family.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"What is SSH?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"irst, we need to know what SSH is to understand why we can clone repositories with it. Secure SHell SSH is a communication protocol that enables a remote terminal connection, e.g. with a server or another computer. Importantly, such connections are encrypted. To establish such a connection, we need a pair of keys: private (saved on our computer\u2019s hard drive) and public, shared with the service we want to connect to. We can quite easily establish such a connection for GitHub, GitLab, and Bitbucket...\"}},{\"@type\":\"Question\",\"name\":\"How to generate a pair of keys?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"With a bash terminal, all you need to do now is type this command:ssh-keygen. Of course, we can provide parameters here, including the type of encryption algorithm, the name of the resulting file, etc., but we will not focus on this today. Let\u2019s use the default options...\"}}]}<\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"generating-a-pair-of-keys\"><strong>Generating a pair of keys<\/strong><\/h2>\n\n\n\n<p>With a bash terminal, <strong>all you need to do now is type this command:<em>ssh-keygen<\/em><\/strong>. Of course, we can provide parameters here, including the type of encryption algorithm, the name of the resulting file, etc., but we will not focus on this today. Let&#8217;s use the default options.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/JsYp-j1MK6oGs7dTDy2rbtfHGOPnD1aKXOKEWefCtmhnXu1w7fpAiJlNVTXavnuF9YUgxtEJL5AyBpJ9YHLUXCuguW6eYB6XWHUxKEwMRiN-zxBg48OvD33d-LIyuFEtunepcuQ\" alt=\"SS- keygen Command\"\/><\/figure><\/div>\n\n\n<p>Leave both <em>file name<\/em> and <em>passphrase <\/em>blank. The default behavior should show something like the above, and in the given location we will find two files with our keys. The default names are <strong>id_rsa<\/strong> and <strong>id_rsa.pub<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/gitprotect.io\/devops-backup-academy.html\" target=\"_blank\" rel=\" noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"346\" src=\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/banner_orange-1024x346.png\" alt=\"DevOps Backup Academy\" class=\"wp-image-6757\" style=\"width:500px;height:auto\" srcset=\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/banner_orange-1024x346.png 1024w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/banner_orange-300x102.png 300w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/banner_orange-768x260.png 768w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/banner_orange-400x135.png 400w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/banner_orange.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"informing-the-service-about-our-public-key\"><strong>Informing the service about our public key<\/strong><\/h2>\n\n\n\n<p>Since we already have the generated keys, we should now deliver one of them to the service we want to talk to using SSH. Let&#8217;s see how it looks on the example of GitHub. We need to enter our account settings and find the following option there:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/pY2VwtPiilzv-p9mOIO_hpBy1QA-2d5KYNMF8NlDpC_2u1Nvx0VxC7liqO3CKC9sICZpjWNGZ15U92TWP90JD4LPHfIZNo7KNUkeJ9V80rlJh7SP5Dcwom8YUjXeRAnL-ioUYUM\" alt=\"SSH and GPG keys\"\/><\/figure><\/div>\n\n\n<p>Then find the <strong>SSH keys<\/strong> section and click the <strong>New SSH<\/strong> key button. Of course, our account can have multiple keys assigned to them, so it&#8217;s worth giving them meaningful names so that we know which device the key applies to. <strong>Remember to add a public key, not a private one<\/strong>! In my case, after adding the previously created key, this section looks like below:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/PDrUIi-9uI8ia_CyqJx0wgJSPezDNcQuRyZ48uDu3Tq9x_BzIxCAYv4xEAIpxoy_VSP2gjKklrjPmTvZEvCaaNCNRljdLnrSnEVAvbs5jrICTJUjE_V1klV_jsBQo8RBw9Ffpng\" alt=\"adding the previously created SSH key\"\/><\/figure><\/div>\n\n\n<p>After adding a new key, it&#8217;s worth to test your connection. In the bash terminal, just type the command: <strong><em>ssh -T git@github.com<\/em><\/strong><\/p>\n\n\n\n<p>An alert is possible here asking if you really want to connect to this <strong>host. It is worth verifying GitHub&#8217;s public key fingerprints at this point<\/strong>. In our case, everything is correct, so we approve. It is important that our GitHub login is included in the confirmation message. If it is not there, or we have the error \u201cpermission denied\u201d, we should check that we did everything right. We can also delete these keys (locally and in GitHub), generate a new pair, and add again. Below is an example of the terminal view after all steps have been correctly completed:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/16z_cO-AFdIW0RwQKPfbdkw9p_7oxv96kxmKNG1m-gH9QnRkpP7l_tZT-zabXcGudwrKRq8pyFQvGRc15wVLVky61sAbpDm0_HCWHkBgRrjSRe1Y3mP1Z8_ihagocUkLDWM52fg\" alt=\"\"\/><\/figure><\/div>\n\n\n<p>Now everything is ready and we can safely perform a <strong><em><a href=\"https:\/\/gitprotect.io\/blog\/how-to-clone-a-git-repository\/\" target=\"_blank\" rel=\"noreferrer noopener\">git clone<\/a><\/em><\/strong> with ssh key. How to do it? There is no magic here anymore, the <em>clone <\/em>function requires the address from which we want to download the project. We just provide the appropriate address using SSH, not HTTPS. <strong>In both GitHub, GitLab, and Bitbucket, the clone with ssh process looks pretty much the same<\/strong>. For example, on GitHub, our repo address format is:<\/p>\n\n\n\n<p><strong><em>git@github.com:USER\/REPO_NAME.git<\/em><\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/-hgBUR4PTjaknkdCBBIbJwOOb5cOZJIFWY1YweYnM8aXUNcXnU2TEQ4ZYnYVCd-aS3GWljYME4Y9AN2vDnodaT8FERw7xMPaHzpKjJ9Jz5-7wFA4Ga1kpv6-epNayYulR_tCDuc\" alt=\"\"\/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"git-clone-with-ssh-key-conclusion\">git clone with ssh key &#8211; <strong>conclusion<\/strong><\/h2>\n\n\n\n<p>As you can see, <strong>using SSH to clone repositories is not difficult<\/strong>. It is important to generate a pair of keys and keep the private key securely. For security reasons, SSH is a very good solution. In the case of private repositories, it allows us to limit the risk of data interception by unauthorized persons.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-1024x1024.png\" alt=\"\" class=\"wp-image-4986\" style=\"width:456px;height:auto\" srcset=\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-1024x1024.png 1024w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-300x300.png 300w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-150x150.png 150w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-768x768.png 768w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-180x180.png 180w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-400x400.png 400w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-600x600.png 600w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone-800x800.png 800w, https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2024\/03\/git-clone.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-1 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-25\"><a class=\"wp-block-button__link has-white-color has-text-color has-background has-text-align-center wp-element-button\" href=\"https:\/\/gitprotect.io\/git-clone-guide.html?utm_source=blog&amp;utm_medium=blog\" style=\"background-color:#2558dc\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Download now<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Another benefit is that SSH keys are unlikely to be changed often, and certainly not as often as passwords. For example, the company, for security reasons, forces the GitHub password to be changed once a month. <strong>If our local backups are connected via SSH<\/strong>, then we are not very interested in this password change and the connection to the remote repo will still be established as long as we have the correct key pair.<\/p>\n\n\n\n<p>Despite the fact that setting up an SSH connection requires a bit more work from us than the usual <em>clone <\/em>via HTTPS, it is still worth doing whenever we care about the security and protection of data in our repository. Every admin, team leader, CTO, or anyone responsible for these matters in the company should make sure that each local copy of the <strong>Git repository is only cloned with SSH key<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"adding-a-new-ssh-key-to-github\">Adding a new SSH Key to GitHub<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Generate keys: <\/strong><br>start with generating the aforementioned pair of keys. To do so, open the bash terminal and type the ssh-keygen command.<\/li>\n\n\n\n<li><strong>Copy the aforementioned pair of keys:<\/strong><br>check for two files with your keys: id_rsa and id_rsa.pub and copy them.<\/li>\n\n\n\n<li><strong>Login into GitHub account:<\/strong><br>go to your GitHub account settings &gt; SSH keys section and then click the New SSH key button.<\/li>\n\n\n\n<li><strong>Test your connection:<\/strong><br>type in the bash terminal ssh -T git@github.com command.<\/li>\n\n\n\n<li><strong>Now you can safely perform a git clone with SSH key:<\/strong><br>to do that provide the appropriate address using SSH, instead of HTTPS.<\/li>\n\n\n\n<li><strong>Congratulation,<\/strong><br>the task was finished with success.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions:<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What is the difference between SSH and HTTPS in git?<\/h3>\n\n\n\n<p>The main difference between SSH and HTTPS in Git is the fact that SSH provides greater security, especially when <a href=\"https:\/\/gitprotect.io\/blog\/how-to-set-up-and-manage-multiple-github-accounts\/\" target=\"_blank\" rel=\"noreferrer noopener\">managing multiple accounts<\/a>. HTTPS uses SSL\/TLS data encryption and not public key cryptography but is commonly used for its simplicity in configuration since it is built directly into the HTTP protocol. However, each action like git pull or push requires you to authenticate yourself.&nbsp;<\/p>\n\n\n\n<p>SSH on the other hand, is a pair of cryptographic keys &#8211; a public and a private key, that guarantee your data cannot be altered or intercepted during the transfer. It is more complex to set up, therefore it is not as commonly used as HTTPS, but SSH provides greater security. Moreover, unlike HTTPS, you do not need to authenticate each action like signing a commit with SSH.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to clone repo without SSH key?<\/h3>\n\n\n\n<p>To clone a repo without an SSH key you have two options. For private repos, you can use PATs (Personal Access Tokens) to clone your repository without an SSH key pair. As for public repos, you could just use HTTPS, which is less secure but allows you to clone the repo if you do not have an SSH key.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Which command is used to copy an SSH key?<\/h3>\n\n\n\n<p>The command which allows you to copy your SSH key is:&nbsp;<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#f4fafe\"><em>\u201cssh-copy-id -i ~\/.ssh\/mykey user@host\u201d<\/em><\/p>\n\n\n\n<p>Using this command, your created key can be installed as an authorized key on a server, leading to granted access to the server with no need for password-based authentication.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can SSH keys be copied?<\/h3>\n\n\n\n<p>Yes, SSH keys can be copied. Simply copy the \u201c~\/.ssh\u201d directory from the desired machine to your new one. Remember that this is sensitive data and it should be transferred using a secure method, for example, you can use a USB drive for it. If you do not plan on using the old machine, make sure to delete these private keys from there.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Before you go:<\/h2>\n\n\n\n<p class=\"has-background\" style=\"background-color:#f4fafe\">\u270d\ufe0f Subscribe to <a href=\"https:\/\/gitprotect.io\/gitprotect-newsletter.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\">GitProtect DevSecOps X-Ray Newsletter<\/a> and always stay up-to-date with the latest DevOps and security insights<br><br>\ud83d\udc40 Discover what are the options to <a href=\"https:\/\/gitprotect.io\/blog\/how-to-clone-a-git-repository\/\" target=\"_blank\" rel=\"noreferrer noopener\">clone a Git repository<\/a> and why it gives you more control over what you do<br><br>\ud83d\udd0e Check out what the <a href=\"https:\/\/gitprotect.io\/blog\/git-backup-or-git-clone-that-is-the-question\/\" target=\"_blank\" rel=\"noreferrer noopener\">difference between Git backup and Git clone<\/a> and why the latter can\u2019t substitute Git backup<br><br>\ud83d\udcda Find out how to <a href=\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-https-in-git\/\" target=\"_blank\" rel=\"noreferrer noopener\">clone using HTTPS in Git<\/a> and what advantages it has<br><br>\ud83d\udcc5 Schedule <a href=\"https:\/\/calendly.com\/d\/3s9-n9z-pgc\/gitprotect-live-demo?month=2024-03\" target=\"_blank\" rel=\"noreferrer noopener\">a live custom demo<\/a> and learn more about GitProtect backups for your DevOps data protection<br><br>\ud83d\udccc Or try <a href=\"https:\/\/gitprotect.io\/sign-up.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\">GitProtect backups for your DevOps <\/a>tools to eliminate data loss and ensure workflow continuity<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Each of us is aware of the importance of security in the IT world. On the other hand, it turns out that not everyone uses appropriate security measures, or sometimes we just don&#8217;t know how to do it. And this is what you will learn from this article &#8211; what is SSH, ssh command, github ssh key, public ssh key, and ssh directory, and more to use in our Git repositories. I also encourage you to read this article: How to clone a repository. It explains the principles of clone operation and further reading will be easier if you first [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":1994,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-1990","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-git-backup-101","post--single"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Clone Using SSH in Git? - Blog | GitProtect.io<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Clone Using SSH in Git? - Blog | GitProtect.io\" \/>\n<meta property=\"og:description\" content=\"Each of us is aware of the importance of security in the IT world. On the other hand, it turns out that not everyone uses appropriate security measures, or sometimes we just don&#8217;t know how to do it. And this is what you will learn from this article &#8211; what is SSH, ssh command, github ssh key, public ssh key, and ssh directory, and more to use in our Git repositories. I also encourage you to read this article: How to clone a repository. It explains the principles of clone operation and further reading will be easier if you first [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | GitProtect.io\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/XoperoSoftware\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-21T13:38:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-13T08:29:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Tomasz Lisowski\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GitProtectio\" \/>\n<meta name=\"twitter:site\" content=\"@GitProtectio\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tomasz Lisowski\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/\"},\"author\":{\"name\":\"Tomasz Lisowski\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/9437be55e0e82150a20247f63e2fef79\"},\"headline\":\"How to Clone Using SSH in Git?\",\"datePublished\":\"2021-07-21T13:38:38+00:00\",\"dateModified\":\"2025-06-13T08:29:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/\"},\"wordCount\":1517,\"publisher\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png\",\"articleSection\":[\"Git Backup 101\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/\",\"url\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/\",\"name\":\"How to Clone Using SSH in Git? - Blog | GitProtect.io\",\"isPartOf\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png\",\"datePublished\":\"2021-07-21T13:38:38+00:00\",\"dateModified\":\"2025-06-13T08:29:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage\",\"url\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png\",\"contentUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png\",\"width\":1200,\"height\":600,\"caption\":\"How to clone using SSH in Git?\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Strona g\u0142\u00f3wna\",\"item\":\"https:\/\/gitprotect.io\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Clone Using SSH in Git?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#website\",\"url\":\"https:\/\/gitprotect.io\/blog\/\",\"name\":\"GitProtect.io Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/gitprotect.io\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#organization\",\"name\":\"GitProtect.io\",\"url\":\"https:\/\/gitprotect.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png\",\"contentUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png\",\"width\":528,\"height\":528,\"caption\":\"GitProtect.io\"},\"image\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/XoperoSoftware\/\",\"https:\/\/x.com\/GitProtectio\",\"https:\/\/www.linkedin.com\/company\/xopero-software\/\",\"https:\/\/www.youtube.com\/channel\/UCiEnl6n0mIO6w7twccz-l2w\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/9437be55e0e82150a20247f63e2fef79\",\"name\":\"Tomasz Lisowski\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/tomasz-lisowski_avatar-96x96.jpg\",\"contentUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/tomasz-lisowski_avatar-96x96.jpg\",\"caption\":\"Tomasz Lisowski\"},\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/tomasz-lisowski-01366a75\/\"],\"url\":\"https:\/\/gitprotect.io\/blog\/author\/tomasz-lisowski\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Clone Using SSH in Git? - Blog | GitProtect.io","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/","og_locale":"en_US","og_type":"article","og_title":"How to Clone Using SSH in Git? - Blog | GitProtect.io","og_description":"Each of us is aware of the importance of security in the IT world. On the other hand, it turns out that not everyone uses appropriate security measures, or sometimes we just don&#8217;t know how to do it. And this is what you will learn from this article &#8211; what is SSH, ssh command, github ssh key, public ssh key, and ssh directory, and more to use in our Git repositories. I also encourage you to read this article: How to clone a repository. It explains the principles of clone operation and further reading will be easier if you first [&hellip;]","og_url":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/","og_site_name":"Blog | GitProtect.io","article_publisher":"https:\/\/www.facebook.com\/XoperoSoftware\/","article_published_time":"2021-07-21T13:38:38+00:00","article_modified_time":"2025-06-13T08:29:42+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png","type":"image\/png"}],"author":"Tomasz Lisowski","twitter_card":"summary_large_image","twitter_creator":"@GitProtectio","twitter_site":"@GitProtectio","twitter_misc":{"Written by":"Tomasz Lisowski","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#article","isPartOf":{"@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/"},"author":{"name":"Tomasz Lisowski","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/9437be55e0e82150a20247f63e2fef79"},"headline":"How to Clone Using SSH in Git?","datePublished":"2021-07-21T13:38:38+00:00","dateModified":"2025-06-13T08:29:42+00:00","mainEntityOfPage":{"@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/"},"wordCount":1517,"publisher":{"@id":"https:\/\/gitprotect.io\/blog\/#organization"},"image":{"@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage"},"thumbnailUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png","articleSection":["Git Backup 101"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/","url":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/","name":"How to Clone Using SSH in Git? - Blog | GitProtect.io","isPartOf":{"@id":"https:\/\/gitprotect.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage"},"image":{"@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage"},"thumbnailUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png","datePublished":"2021-07-21T13:38:38+00:00","dateModified":"2025-06-13T08:29:42+00:00","breadcrumb":{"@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#primaryimage","url":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png","contentUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2021\/07\/clone22.png","width":1200,"height":600,"caption":"How to clone using SSH in Git?"},{"@type":"BreadcrumbList","@id":"https:\/\/gitprotect.io\/blog\/how-to-clone-using-ssh-in-git\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Strona g\u0142\u00f3wna","item":"https:\/\/gitprotect.io\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Clone Using SSH in Git?"}]},{"@type":"WebSite","@id":"https:\/\/gitprotect.io\/blog\/#website","url":"https:\/\/gitprotect.io\/blog\/","name":"GitProtect.io Blog","description":"","publisher":{"@id":"https:\/\/gitprotect.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gitprotect.io\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/gitprotect.io\/blog\/#organization","name":"GitProtect.io","url":"https:\/\/gitprotect.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png","contentUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png","width":528,"height":528,"caption":"GitProtect.io"},"image":{"@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/XoperoSoftware\/","https:\/\/x.com\/GitProtectio","https:\/\/www.linkedin.com\/company\/xopero-software\/","https:\/\/www.youtube.com\/channel\/UCiEnl6n0mIO6w7twccz-l2w"]},{"@type":"Person","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/9437be55e0e82150a20247f63e2fef79","name":"Tomasz Lisowski","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/tomasz-lisowski_avatar-96x96.jpg","contentUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/tomasz-lisowski_avatar-96x96.jpg","caption":"Tomasz Lisowski"},"sameAs":["https:\/\/www.linkedin.com\/in\/tomasz-lisowski-01366a75\/"],"url":"https:\/\/gitprotect.io\/blog\/author\/tomasz-lisowski\/"}]}},"_links":{"self":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts\/1990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/comments?post=1990"}],"version-history":[{"count":21,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts\/1990\/revisions"}],"predecessor-version":[{"id":6761,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts\/1990\/revisions\/6761"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/media\/1994"}],"wp:attachment":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/media?parent=1990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/categories?post=1990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/tags?post=1990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}