{"id":69,"date":"2014-06-17T22:16:38","date_gmt":"2014-06-17T16:46:38","guid":{"rendered":"http:\/\/codeforgeek.com\/?p=69"},"modified":"2022-08-09T15:24:46","modified_gmt":"2022-08-09T09:54:46","slug":"best-github-tutorial","status":"publish","type":"post","link":"https:\/\/codeforgeek.com\/best-github-tutorial\/","title":{"rendered":"Beginner\u2019s Guide to Using Git and GitHub"},"content":{"rendered":"<p>This tutorial is all about Github &#8211; An online source code management system and social code sharing community. Whether you are a computer professional or college kid you should have Github as skills added to your resume.<\/p>\n<h2>Git History<\/h2>\n<p>Let&#8217;s go back to history! We all know about <a title=\"Linux wikipedia\" href=\"https:\/\/en.wikipedia.org\/wiki\/Linux\" target=\"_blank\" rel=\"noopener noreferrer\">Linux<\/a>, a revolutionary OS with lots of possibilites. During its development there were thousand&#8217;s of developer around globe working on it. Then the need of source code management came and result was a piece of software called &#8216;<a title=\"Git home page\" href=\"https:\/\/git-scm.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Git<\/a>&#8216; originally written by super smart guy <a title=\"Linus Torvalds\" href=\"https:\/\/en.wikipedia.org\/wiki\/Linus_Torvalds\" target=\"_blank\" rel=\"noopener noreferrer\">Linus Torvalds<\/a>.<\/p>\n<p>External link: <a title=\"Youtube Video\" href=\"https:\/\/www.youtube.com\/watch?v=4XpnKHJAok8\" target=\"_blank\" rel=\"noopener noreferrer\">Linus torvald explains Git in Google Conference.<\/a><\/p>\n<h2>GitHub History<\/h2>\n<p>Let&#8217;s start with <b>GitHub<\/b>. I am using <strong>Ubuntu 18.04<\/strong> in which Git is placed in Kernel. If you are Mac user then it may be integrated in system (check by typing git on terminal) or you can download it from <a title=\"Download Git for mac\" href=\"https:\/\/git-scm.com\/download\/mac\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>The same step goes for Windows user&#8217;s and people using Windows must download Git first before moving ahead with the tutorial.<\/p>\n<p>External link: <a title=\"Download GIT for Mac and windows\" href=\"https:\/\/git-scm.com\/downloads\" target=\"_blank\" rel=\"noopener noreferrer\">Download Git for Mac and Window.<\/a><\/p>\n<h2>Step 1: Create Account on Github.com<\/h2>\n<p>To be able to share your work with others, you have to create an account. The step is simple and very quick because the registration form has only 3 fields. Go to <a title=\"Github official site\" href=\"https:\/\/github.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Github.com<\/a> and create your account.<\/p>\n<h2>Step 2: Create Repository on Github.<\/h2>\n<p>Repository ( or directory, folder, etc) contains your project. You can add, delete, edit and most importantly share the repository. Browse to &#8216;+&#8217; button on right side of your name in top bar and click on <strong>&#8216;New Repository&#8217;<\/strong>.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-73\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180542.png\" alt=\"New repository\" width=\"394\" height=\"129\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180542.png 394w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180542-300x98.png 300w\" sizes=\"(max-width: 394px) 100vw, 394px\" \/><\/p>\n<p>Give it a proper name. Don&#8217;t go for a too long one. Then save it and keep the browser tab open. This is what I got.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-74\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180604.png\" alt=\"Repository of Github\" width=\"763\" height=\"483\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180604.png 763w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180604-300x190.png 300w\" sizes=\"(max-width: 763px) 100vw, 763px\" \/><\/p>\n<h2>Step 3: Adding project to Repository<\/h2>\n<p>Here comes an interesting part. Let&#8217;s add one dummy project into our repository. Create any folder and add any file (text, PHP, HTML, node.js, etc. whichever you want) into it. Once you have done adding the file then follow the steps below.<\/p>\n<p>Open up your terminal or console or command prompt depending upon your operating system. Switch to the folder you have created using CD &lt;Your folder name&gt;.<\/p>\n<p>Type following commands one by one in your terminal. I will explain them in the next section.<\/p>\n<p><code><br \/>\ngit init<br \/>\ntouch README<br \/>\ngit add .<br \/>\ngit commit -m \"Hello my first commit\"<br \/>\n<\/code><\/p>\n<p>Now following commands are very important and used to upload your project into the repository you have created on Github.<\/p>\n<p><code><br \/>\ngit remote add origin https:\/\/github.com\/Your_User_name\/your_repository_name.git<br \/>\n<\/code><\/p>\n<p>After this final command to push the changes from local to the remote repository.<\/p>\n<p><code>git push origin master<\/code><\/p>\n<p>It will ask you to provide your username and password which you have used to create the GitHub account. Here is a screenshot for help if you stuck.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-71\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180948.png\" alt=\"Complete GITHUB command\" width=\"842\" height=\"514\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180948.png 842w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180948-768x469.png 768w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180948-300x183.png 300w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><\/p>\n<p>Hey! you are done with adding the repository. Just go to Github.com and check it. Now as promised above, here is an explanation of each command.<\/p>\n<p>The first command starts the Git. The second command creates one file which is required for Github.com. You can edit it and put details about your projects such as installation details or external links or any kind of information you want. <\/p>\n<p>The third command adds all of the files in the current directory (subdirectories are also included if it is there in your project).<\/p>\n<p>Now we have added the files to Git, it&#8217;s time to save the changes and <strong>commit<\/strong> it. You can relate <strong>&#8220;commit&#8221;<\/strong> operation with <strong>finalizing<\/strong> operation, a phase where project is ready to deploy.<\/p>\n<p>In the next two commands, we have pointed our Git to the GitHub repository and Push it into it by providing our valid Github account credentials. After successful execution of the command just refresh the GitHub page and you should see your changes.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-75\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180955.png\" alt=\"Final step to add repository\" width=\"1075\" height=\"527\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180955.png 1075w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180955-768x376.png 768w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180955-300x147.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/Screenshot-from-2014-06-17-180955-1024x502.png 1024w\" sizes=\"(max-width: 1075px) 100vw, 1075px\" \/><\/p>\n<p>If above steps are too long and you prefer video over it then watch it here. Yes this is official <a title=\"Youtube Channel\" href=\"https:\/\/www.youtube.com\/user\/codeforgeek\" target=\"_blank\" rel=\"noopener noreferrer\">CodeForGeek YouTube Channel<\/a>.<br \/>\n<iframe src=\"\/\/www.youtube.com\/embed\/osvPhazF4m4\" width=\"854\" height=\"510\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial is all about Github &#8211; An online source code management system and social code sharing community. Whether you are a computer professional or college kid you should have Github as skills added to your resume. Git History Let&#8217;s go back to history! We all know about Linux, a revolutionary OS with lots of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":70,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_surecart_dashboard_logo_width":"180px","_surecart_dashboard_show_logo":true,"_surecart_dashboard_navigation_orders":true,"_surecart_dashboard_navigation_invoices":true,"_surecart_dashboard_navigation_subscriptions":true,"_surecart_dashboard_navigation_downloads":true,"_surecart_dashboard_navigation_billing":true,"_surecart_dashboard_navigation_account":true,"_uag_custom_page_level_css":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-69","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-miscellaneous"],"blocksy_meta":[],"uagb_featured_image_src":{"full":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/banner.png",640,400,false],"thumbnail":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/banner-150x150.png",150,150,true],"medium":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/banner-300x188.png",300,188,true],"medium_large":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/banner.png",640,400,false],"large":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/banner.png",640,400,false],"1536x1536":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/banner.png",640,400,false],"2048x2048":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2014\/06\/banner.png",640,400,false]},"uagb_author_info":{"display_name":"Shahid","author_link":"https:\/\/codeforgeek.com\/author\/shahid\/"},"uagb_comment_info":0,"uagb_excerpt":"This tutorial is all about Github &#8211; An online source code management system and social code sharing community. Whether you are a computer professional or college kid you should have Github as skills added to your resume. Git History Let&#8217;s go back to history! We all know about Linux, a revolutionary OS with lots of&hellip;","_links":{"self":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/comments?post=69"}],"version-history":[{"count":0,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/media\/70"}],"wp:attachment":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}