{"id":4437,"date":"2018-03-09T19:20:02","date_gmt":"2018-03-09T19:20:02","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/03\/09\/how-to-publish-your-jekyll-site-with-scp\/"},"modified":"2021-08-16T22:28:19","modified_gmt":"2021-08-17T02:28:19","slug":"how-to-publish-your-jekyll-site-with-scp","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/","title":{"rendered":"How to Publish Your Jekyll Site with SCP"},"content":{"rendered":"<pre><code>In this article, we'll show you how you can automate your publishing process with secure copy (SCP).    In the &lt;a href=\"\/support\/website\/jekyll\/how-to-customize-your-jekyll-site\/\"&gt;customizing Jekyll&lt;\/a&gt; article we learned about how you can change the base directory of your site.     This means you will be building your site into a specific directory, which is going to be important later. &lt;\/p&gt; &lt;p&gt;     Then, we can create a simple script that will grab your base directory and copy it to your server with minimal effort on your part. &lt;\/p&gt; &lt;h2&gt;SSH Access&lt;\/h2&gt; &lt;p&gt;    In order for this process to work easily and quickly, you will want to set up an &lt;a href=\"\/support\/server\/ssh\/how-to-generate-ssh-keys\/\"&gt;SSH key&lt;\/a&gt; on your computer and then &lt;a href=\"\/support\/website\/general-server-setup\/self-managed\/manage-ssh-keys#add-key\"&gt;add the key to your server&lt;\/a&gt;.     Why?    SCP uses the &lt;a href=\"\/support\/server\/ssh\/how-to-login-ssh\/\"&gt;SSH&lt;\/a&gt; protocol to transfer files to your server.     This means you will require a password in order to make our script run.     With an SSH key, however, we can skip the password phase and transfer files directly.   This is also considered a more secure way to control access to your server. &lt;\/p&gt; &lt;h2&gt;Change your Jekyll Build Base Directory&lt;\/h2&gt; &lt;p&gt;   As mentioned above, you will want to &lt;a href=\"\/support\/website\/jekyll\/how-to-customize-your-jekyll-site\/\"&gt;customize your Jekyll installation&lt;\/a&gt; to \"build\" your site into a directory called &lt;em&gt;public_html&lt;\/em&gt;.     This will work better with your InMotion Hosting cPanel server, which has already chosen the &lt;em&gt;public_html&lt;\/em&gt; directory as the &lt;a href=\"\/support\/website\/where-to-upload-files\/\"&gt;document root&lt;\/a&gt;. &lt;\/p&gt; &lt;h2&gt;   Creating the SCP Script &lt;\/h2&gt; &lt;p&gt;   Now that you have added the SSH key to your server, we can create the SCP script.   This kind of scripting is very specific and may differ based on individual use cases.   This is why I'll emphasize that this is merely one way among many to accomplish the same goal.  You might take this as inspiration to create your own script, or, what we've provided here may be sufficient for your needs. &lt;\/p&gt; &lt;p&gt;   What we're going to do is create an executable script that will transfer our &lt;code&gt;public_html&lt;\/code&gt; directory in our Jekyll site to our server location. &lt;\/p&gt; &lt;p&gt;  The steps must be completed on your local computer, not your server. &lt;\/p&gt; &lt;ol class=\"article_list\"&gt; &lt;li&gt;Create a new file on your computer called &lt;em&gt;publish-site.sh&lt;\/em&gt; (you may name it anything you want, this is only an example)&lt;\/li&gt; &lt;li&gt;Open the file for editing with your text editor&lt;\/li&gt; &lt;li&gt;Add the following code into your file:&lt;br\/&gt;&lt;pre class=\"code_block\"&gt; #!\/bin\/bash scp -rp \/path\/to\/jekyll\/public_html userna5@example.com:~\/&lt;\/pre&gt;&lt;br\/&gt;Making sure that you update the path to your Jekyll site and substitute the example.com server information for your own&lt;\/li&gt; &lt;li&gt;Open your terminal application&lt;\/li&gt; &lt;li&gt;Use the &lt;span class=\"cli\"&gt;cd&lt;\/span&gt; command to change into the directory where you created the &lt;em&gt;publish_site.sh&lt;\/em&gt; file (if you created it in your home folder, you may already be in the right place)&lt;\/li&gt; &lt;li&gt;Use the following command to make the file executable:&lt;br\/&gt;&lt;pre class=\"cli\"&gt; sudo chmod +x &lt;span style=\"color:green;\"&gt;publish-site.sh&lt;\/span&gt; &lt;\/pre&gt;&lt;\/li&gt; &lt;li&gt;Run the executable file by adding a period and forward slash before it:&lt;br\/&gt;&lt;pre class=\"cli\"&gt; .\/&lt;span style=\"color:green;\"&gt;publish-site.sh&lt;\/span&gt; &lt;\/pre&gt;&lt;\/li&gt; &lt;\/ol&gt; &lt;p&gt;   Now your command should automatically use SCP to transfer the files to your server without your having to log into your server.     Every time you make changes to your site, use &lt;code&gt;jekyll build&lt;\/code&gt; to build the site and your custom script to transfer the files. \n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we&#8217;ll show you how you can automate your publishing process with secure copy (SCP). In the &lt;a href=&#8221;\/support\/website\/jekyll\/how-to-customize-your-jekyll-site\/&#8221;&gt;customizing Jekyll&lt;\/a&gt; article we learned about how you can change the base directory of your site. This means you will be building your site into a specific directory, which is going to be important later.<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\"> Read More ><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4306],"tags":[],"class_list":["post-4437","post","type-post","status-publish","format-standard","hentry","category-jekyll"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Publish Your Jekyll Site with SCP | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"In this article we&#039;re going to write an executable script with SCP that will transfer our site files to the server.\" \/>\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.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Publish Your Jekyll Site with SCP | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"In this article we&#039;re going to write an executable script with SCP that will transfer our site files to the server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-09T19:20:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-17T02:28:19+00:00\" \/>\n<meta name=\"author\" content=\"Christopher Maiorana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Maiorana\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\"},\"author\":{\"name\":\"Christopher Maiorana\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\"},\"headline\":\"How to Publish Your Jekyll Site with SCP\",\"datePublished\":\"2018-03-09T19:20:02+00:00\",\"dateModified\":\"2021-08-17T02:28:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\"},\"wordCount\":8,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Jekyll\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\",\"name\":\"How to Publish Your Jekyll Site with SCP | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2018-03-09T19:20:02+00:00\",\"dateModified\":\"2021-08-17T02:28:19+00:00\",\"description\":\"In this article we're going to write an executable script with SCP that will transfer our site files to the server.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Publish Your Jekyll Site with SCP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\",\"name\":\"Christopher Maiorana\",\"description\":\"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Publish Your Jekyll Site with SCP | InMotion Hosting","description":"In this article we're going to write an executable script with SCP that will transfer our site files to the server.","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.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/","og_locale":"en_US","og_type":"article","og_title":"How to Publish Your Jekyll Site with SCP | InMotion Hosting","og_description":"In this article we're going to write an executable script with SCP that will transfer our site files to the server.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-03-09T19:20:02+00:00","article_modified_time":"2021-08-17T02:28:19+00:00","author":"Christopher Maiorana","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Christopher Maiorana","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/"},"author":{"name":"Christopher Maiorana","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f"},"headline":"How to Publish Your Jekyll Site with SCP","datePublished":"2018-03-09T19:20:02+00:00","dateModified":"2021-08-17T02:28:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/"},"wordCount":8,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Jekyll"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/","name":"How to Publish Your Jekyll Site with SCP | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2018-03-09T19:20:02+00:00","dateModified":"2021-08-17T02:28:19+00:00","description":"In this article we're going to write an executable script with SCP that will transfer our site files to the server.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/jekyll\/how-to-publish-your-jekyll-site-with-scp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Publish Your Jekyll Site with SCP"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f","name":"Christopher Maiorana","description":"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.","sameAs":["https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4437"}],"version-history":[{"count":1,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4437\/revisions"}],"predecessor-version":[{"id":83738,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4437\/revisions\/83738"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}