{"componentChunkName":"component---src-templates-blog-template-js","path":"/How-I-deployed-my-portfolio","result":{"data":{"markdownRemark":{"html":"<h1>1. Introduction</h1>\n<p>Hi,\nthis a simple note to remember how i deployed my personal portfolio.</p>\n<h1>2. Why I chose this solution</h1>\n<p>I decided to develop my personal portfolio using GatsbyJs mainly for these reasons:</p>\n<ul>\n<li>Hosting is very cheap (completely free on Github)</li>\n<li>The website is static and that means that is very fast compared with websites developed with CMS like wordpress</li>\n<li>I found a very good documentation on the official websites</li>\n<li>I loved that template as soon as I saw it </li>\n</ul>\n<h1>3. Let's prepare everything</h1>\n<p>To be as clear as possible I decided to write an ordered list.</p>\n<ol>\n<li>Download GIT from <a href=\"https://git-scm.com/downloads\">here</a></li>\n<li>Download Nodejs <a href=\"https://nodejs.org/it/download/\">here</a></li>\n<li>Install GIT</li>\n<li>Install Nodejs</li>\n<li>Create a folder where you prefer</li>\n<li>Right Clik and select <code class=\"language-text\">GIT Bash Here</code></li>\n<li>Find your favourite template on the <a href=\"https://www.gatsbyjs.org/starters?v=2\">official website</a> and save the url written under the picture of the project</li>\n<li>Create e new <strong>public</strong> repository in Github following this path <code class=\"language-text\">&lt;yourUsername&gt;.github.io</code> and copy the url of the project</li>\n<li>Follow these commands in order </li>\n</ol>\n<h1>4. Follow these simple commands</h1>\n<ol>\n<li>\n<p><code class=\"language-text\">gatsby new &lt;nomeProgetto&gt; &lt;urlDelTemplateScelto&gt;</code> </p>\n<blockquote>\n<p>This will create a folder named <code class=\"language-text\">nomeProgetto</code> with a lot of files needed for your websites</p>\n</blockquote>\n</li>\n<li>\n<p><code class=\"language-text\">cd &lt;nomeProgetto&gt;</code> Remember to change <nomeProgetto> with the name of the project that you have chosen before</p>\n<blockquote>\n<p>This will change the working directory of the program</p>\n</blockquote>\n</li>\n<li><code class=\"language-text\">git remote remove origin</code> generally is not neded but anyway to prevent problems launch it </li>\n<li>\n<p><code class=\"language-text\">git remote add origin &lt;urlOfYourGithubProject&gt;</code> </p>\n<blockquote>\n<p>This command is very important because it will connect your local website with the cloud. Check that the url is right typing <code class=\"language-text\">git remote -v</code> </p>\n</blockquote>\n</li>\n<li><code class=\"language-text\">git branch -m develop</code></li>\n</ol>\n<blockquote>\n<p>With this command we are creating a branch to store our \"developing\" files, in the other branch there will be the website</p>\n</blockquote>\n<ol start=\"6\">\n<li><code class=\"language-text\">git push -u origin develop</code> With this command we are going to save our building file </li>\n<li><code class=\"language-text\">npm install gh-pages --save-dev</code> This is the command used to install the plugin that will \"send\" your website to github cloud</li>\n<li>Now we need to edit the file named <code class=\"language-text\">package.json</code> adding this line inside of the group scripts. At the end you will have something like this</li>\n</ol>\n<div class=\"gatsby-highlight\" data-language=\"javascript\"><pre class=\"language-javascript\"><code class=\"language-javascript\"><span class=\"token punctuation\">{</span>\n<span class=\"token punctuation\">[</span><span class=\"token operator\">...</span>other code<span class=\"token operator\">...</span><span class=\"token punctuation\">]</span>\n  <span class=\"token string\">\"scripts\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token string\">\"deploy\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"gatsby build &amp;&amp; gh-pages -d public -b master\"</span>\n    <span class=\"token punctuation\">[</span><span class=\"token operator\">...</span>other code<span class=\"token operator\">...</span><span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">[</span><span class=\"token operator\">...</span>other code<span class=\"token operator\">...</span><span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<ol start=\"9\">\n<li><code class=\"language-text\">npm run deploy</code> to send your website in the cloud</li>\n</ol>\n<p>#5. Other useful commands\nRemember to open GIT bash directly in the folder of your project</p>\n<ul>\n<li><code class=\"language-text\">gatsby develop</code> to check in real time the changes running your website on a local server, after editing never forget to run</li>\n<li>\n<p><code class=\"language-text\">npm run deploy</code> to send the new version of your website in the cloud</p>\n<p>@</p>\n</li>\n</ul>","frontmatter":{"date":"February 20, 2020","path":"/How-I-deployed-my-portfolio","title":"How I deployed my portfolio","thumbnail":"assets/MyPortfolio.webp","metaDescription":"How I deployed my portfolio"}}},"pageContext":{}},"staticQueryHashes":["3159585216"]}