{"id":6902,"date":"2019-12-11T11:03:12","date_gmt":"2019-12-11T11:03:12","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=6902"},"modified":"2022-02-18T13:58:45","modified_gmt":"2022-02-18T13:58:45","slug":"learn-to-set-up-access-to-private-repositories-using-git","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/","title":{"rendered":"Learn to Set Up Access to Private Repositories Using Git"},"content":{"rendered":"<h3>Overview<\/h3>\n<p>Since they require SSH access, you must perform additional steps in order to clone a privately-hosted remote repository.<\/p>\n<div class=\"kb-wisdom-wrapr kb-wisdom-info kb-wisdom-wrapr-blue\">\n<div class=\"kb-wisdom-col kb-wisdom-col-icon\">\n<div class=\"kb-wisdom-icon\">\n<div>&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"kb-wisdom-col kb-wisdom-col-content\">\n<p><strong>Important:<\/strong><\/p>\n<ul>\n<li>In this tutorial <strong>GitHub<\/strong> is used as an example host for a private repository. But, most of the steps in this tutorial are similar to the steps for any other private repository host.<\/li>\n<li>You will need the <strong>Shell Access<\/strong> feature in cPanel &amp; WHM version<strong> 70<\/strong> or earlier or the <strong>Shell Access &amp; Terminal<\/strong> setting in cPanel &amp; WHM version <strong>72<\/strong> or later.<\/li>\n<li>It is appropriate to use cPanel&#8217;s Terminal interface (<strong>cPanel &gt;&gt; Home &gt;&gt; Advanced &gt;&gt; Terminal<\/strong>) to access the command line from within the cPanel interface.<\/li>\n<li>Due to this feature several restrictions are implemented on clone URLs, and it verifies the remote host&#8217;s public SSH keys for <em>ssh:\/\/<\/em> clone URLs. For more information, read the <a href=\"https:\/\/documentation.cpanel.net\/display\/74Docs\/Git+Version+Control\" target=\"_blank\" rel=\"nofollow noopener\">Git Version Control<\/a> documentation.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<h2>Steps to Set up Access to Private Repositories<\/h2>\n<h3>Step 1: Generate An SSH Key<\/h3>\n<p>In case, you have not already configured one, run the below command to generate an SSH key:<\/p>\n<pre class=\"lang:default decode:true \">ssh-keygen -t rsa -b 4096 -C \"username@example\"<\/pre>\n<p>Here the username indicates the cPanel account username and example indicates the domain name.<\/p>\n<p>After executing this command, the system will ask you to enter a passphrase. Do not enter a passphrase, but just press <strong>Enter<\/strong> to continue.<\/p>\n<h3>Step 2: Confirm that the SSH Key Generated is Correct<\/h3>\n<p>For confirming that the key exists and is in the correct location, execute the below command:<\/p>\n<pre class=\"lang:default decode:true \">cat ~\/.ssh\/id_rsa.pub<\/pre>\n<p>The output should match the below example, where AAAAB3Nza&#8230; indicates a valid SSH key:<\/p>\n<pre class=\"lang:default decode:true \">ssh-rsa AAAAB3Nza...<\/pre>\n<div class=\"kb-wisdom-wrapr kb-wisdom-info kb-wisdom-wrapr-blue\">\n<div class=\"kb-wisdom-col kb-wisdom-col-icon\">\n<div class=\"kb-wisdom-icon\">\n<div>&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"kb-wisdom-col kb-wisdom-col-content\">\n<p><strong>Important:<\/strong><br \/>\nNote the full SSH key as you will need it in Step 3.<\/p>\n<\/div>\n<\/div>\n<p>If the output matches the below example, check that you entered it correctly, and then execute the command in Step 1 again:<\/p>\n<pre class=\"lang:default decode:true \">cat: \/home\/username\/.ssh\/id_rsa.pub: No such file or directory<\/pre>\n<p>If the output matches the below example, ensure that you executed the cat command with the correct path:<\/p>\n<pre class=\"lang:default decode:true\">----BEGIN RSA PRIVATE KEY-----\nAQKCAgByFAHL2301vtIuUQ+jy7+6MoHlXwa0G7Ob\/R1KOthYw3KMr\/cCQycZimcZ<\/pre>\n<h3>Step 3: Register Your SSH Key with the Private Repository Host<\/h3>\n<div class=\"kb-wisdom-wrapr kb-wisdom-warning kb-wisdom-wrapr-red\">\n<div class=\"kb-wisdom-col kb-wisdom-col-icon\">\n<div class=\"kb-wisdom-icon\">\n<div>&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"kb-wisdom-col kb-wisdom-col-content\">\n<p><strong>Notes:<\/strong><\/p>\n<ul>\n<li>To learn about how to register your SSH key with another private repository host, contact that host or check for their documentation.<\/li>\n<li>Some repository hosts, such as <strong>Bitbucket<\/strong>, won\u2019t allow you to configure write access for your access keys.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p>Follow the below steps to register an SSH key with GitHub:<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li>Log in to your <strong>GitHub<\/strong> account.<\/li>\n<li>Go to your private repository.<\/li>\n<li>Click on <strong>Settings<\/strong> located in the top right corner of the page. This will display a new page.<\/li>\n<li>Click on <strong>Deploy<\/strong> keys, in the left side menu. This will display a new page.<\/li>\n<li>Click on <strong>Add deploy key<\/strong>, in the top right corner of the page. This will display a new page.<\/li>\n<li>Then enter your <strong>SSH<\/strong> <strong>key<\/strong> data:\n<ul>\n<li>In the <strong>Title<\/strong> text box, type a display name for the key.<\/li>\n<li>In the <strong>Key<\/strong> text box, paste the entire SSH key.<\/li>\n<\/ul>\n<\/li>\n<li>In order to push code from your cPanel account to your GitHub account, tick the <strong>Allow write access<\/strong> checkbox.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<div class=\"kb-wisdom-wrapr kb-wisdom-warning kb-wisdom-wrapr-red\">\n<div class=\"kb-wisdom-col kb-wisdom-col-icon\">\n<div class=\"kb-wisdom-icon\">\n<div>&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"kb-wisdom-col kb-wisdom-col-content\">\n<p><strong>Note:<\/strong><br \/>\nIn case you don\u2019t tick this checkbox, you can only make changes from your GitHub repository to the cPanel-hosted repository.<\/p>\n<\/div>\n<\/div>\n<ol>\n<li>Click <strong>Add<\/strong> <strong>key<\/strong>.<\/li>\n<\/ol>\n<h3>Test the SSH Key<\/h3>\n<p>Run the below command to test your SSH key, where example.com represents the private repository&#8217;s host:<\/p>\n<pre class=\"lang:default decode:true \">ssh -T git@example.com<\/pre>\n<h3>Clone the Repository<\/h3>\n<p>In order to clone the repository, execute the below command on the cPanel account, where <em>git@example.com:MyStuff\/private-repository.git<\/em> indicates the private repository&#8217;s clone URL:<\/p>\n<pre class=\"lang:default decode:true\">git clone git@example.com:MyStuff\/private-repository.git<\/pre>\n<p>In this way, you can setup access to private repositories using Git.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Overview Since they require SSH access, you must perform additional steps in order to clone a privately-hosted remote repository. &nbsp; Important: In this tutorial GitHub is used as an example host for a private repository. But, most of the steps in this tutorial are similar to the steps for any other private repository host. You [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1149,1148,1147],"class_list":["post-6902","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-cpanel-faq","tag-access-to-private-repositories","tag-git","tag-private-repositories"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Learn to Set Up Access to Private Repositories Using Git<\/title>\n<meta name=\"description\" content=\"The article describes the steps to setup access to private repositories using Git.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn to Set Up Access to Private Repositories Using Git\" \/>\n<meta property=\"og:description\" content=\"The article describes the steps to setup access to private repositories using Git.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-11T11:03:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-18T13:58:45+00:00\" \/>\n<meta name=\"author\" content=\"Pallavi Godse\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pallavi Godse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/\",\"name\":\"Learn to Set Up Access to Private Repositories Using Git\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"datePublished\":\"2019-12-11T11:03:12+00:00\",\"dateModified\":\"2022-02-18T13:58:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"description\":\"The article describes the steps to setup access to private repositories using Git.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learn to Set Up Access to Private Repositories Using Git\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\",\"name\":\"Pallavi Godse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"caption\":\"Pallavi Godse\"},\"description\":\"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Learn to Set Up Access to Private Repositories Using Git","description":"The article describes the steps to setup access to private repositories using Git.","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:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/","og_locale":"en_GB","og_type":"article","og_title":"Learn to Set Up Access to Private Repositories Using Git","og_description":"The article describes the steps to setup access to private repositories using Git.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2019-12-11T11:03:12+00:00","article_modified_time":"2022-02-18T13:58:45+00:00","author":"Pallavi Godse","twitter_misc":{"Written by":"Pallavi Godse","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/","name":"Learn to Set Up Access to Private Repositories Using Git","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"datePublished":"2019-12-11T11:03:12+00:00","dateModified":"2022-02-18T13:58:45+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"description":"The article describes the steps to setup access to private repositories using Git.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/learn-to-set-up-access-to-private-repositories-using-git\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"Learn to Set Up Access to Private Repositories Using Git"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945","name":"Pallavi Godse","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","caption":"Pallavi Godse"},"description":"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/"}]}},"views":530,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=6902"}],"version-history":[{"count":6,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6902\/revisions"}],"predecessor-version":[{"id":16872,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6902\/revisions\/16872"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=6902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=6902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=6902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}