{"id":282,"date":"2022-02-18T22:37:18","date_gmt":"2022-02-18T22:37:18","guid":{"rendered":"https:\/\/liangqi.org\/?p=282"},"modified":"2022-02-26T12:44:16","modified_gmt":"2022-02-26T12:44:16","slug":"git-cheatsheet","status":"publish","type":"post","link":"https:\/\/liangqi.org\/?p=282","title":{"rendered":"How to create a new repo in github?"},"content":{"rendered":"\n<p>If you write codes only for your job and don&#8217;t really try to have your personal little projects you may never create a brand new project in repo even you have been written codes for years. So how to create a new repo in gitbut sounds easy but a lot of experienced developers may never do that.<\/p>\n\n\n\n<p>Int he other hand, whether he\/she can create a repo without any trouble or google search is a arguable way to determine whether he\/she is a <strong>passionate<\/strong> developers or not (no argument needed here, personal option).. <\/p>\n\n\n\n<p>Ok. let&#8217;s start.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Normally when you build a new repo you may use third part bootstrap tool to generate the template of the project. For example you may use spring initializr to do that: <a href=\"https:\/\/start.spring.io\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/start.spring.io<\/a><\/li><li>Init your local git repo:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>git init\ngit add .\ngit commit -m \"initial commit\"<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Login into github and create a new repo. <strong>Please make sure you don&#8217;t do the initial commit since it would make it conflict with local copy<\/strong>. You want to start from your local template from scratch.<\/li><li>Since you have already created the repo locally, you just need to map it to the repo in github.<\/li><\/ul>\n\n\n\n<pre id=\"empty-setup-push-repo-echo\" class=\"wp-block-code\"><code>git remote add origin git@github.com:liangqiw\/config.git\ngit branch -M master\ngit push -u origin master<\/code><\/pre>\n\n\n\n<p>Notes: <\/p>\n\n\n\n<p>Technically you don&#8217;t need to have a remote repo you can just init the local git repo which may be good enough if you feel it&#8217;s just a test project you are working on. People easily forget this if they come from the old fashion version control tool like SVN..<\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-b2cd76f4-e4ee-4128-88bb-c939ae553b10\"><li>Discard all local changes<br><code>git reset; git checkout .;<\/code><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you write codes only for your job and don&#8217;t really try to have your personal little projects you may never create a brand new project in repo even you have been written codes for years. So how to create a new repo in gitbut sounds easy but a lot of experienced developers may never do that. Int he other hand, whether he\/she can create a repo without any trouble or google search is a arguable way to determine whether he\/she is a passionate developers or not (no argument needed here, personal option).. Ok. let&#8217;s start. Normally when you build a new repo you may use third part bootstrap tool to generate the template of the project. For example you may use spring initializr to do that: https:\/\/start.spring.io Init your local git repo: Login into github and create a new repo. Please make sure you don&#8217;t do the initial commit since it would make it conflict with local copy. You want to start from your local template from scratch. Since you have already created the repo locally, you just need to map it to the repo in github. Notes: Technically you don&#8217;t need to have a remote repo you can just init the local git repo which may be good enough if you feel it&#8217;s just a test project you are working on. People easily forget this if they come from the old fashion version control tool like SVN.. Discard all local changesgit reset; git checkout .;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,16],"tags":[],"class_list":["post-282","post","type-post","status-publish","format-standard","hentry","category-29","category-16"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create a new repo in github? - Liangqi\u2018s Technical Journey<\/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:\/\/liangqi.org\/?p=282\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create a new repo in github? - Liangqi\u2018s Technical Journey\" \/>\n<meta property=\"og:description\" content=\"If you write codes only for your job and don&#8217;t really try to have your personal little projects you may never create a brand new project in repo even you have been written codes for years. So how to create a new repo in gitbut sounds easy but a lot of experienced developers may never do that. Int he other hand, whether he\/she can create a repo without any trouble or google search is a arguable way to determine whether he\/she is a passionate developers or not (no argument needed here, personal option).. Ok. let&#8217;s start. Normally when you build a new repo you may use third part bootstrap tool to generate the template of the project. For example you may use spring initializr to do that: https:\/\/start.spring.io Init your local git repo: Login into github and create a new repo. Please make sure you don&#8217;t do the initial commit since it would make it conflict with local copy. You want to start from your local template from scratch. Since you have already created the repo locally, you just need to map it to the repo in github. Notes: Technically you don&#8217;t need to have a remote repo you can just init the local git repo which may be good enough if you feel it&#8217;s just a test project you are working on. People easily forget this if they come from the old fashion version control tool like SVN.. Discard all local changesgit reset; git checkout .;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/liangqi.org\/?p=282\" \/>\n<meta property=\"og:site_name\" content=\"Liangqi\u2018s Technical Journey\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-18T22:37:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-26T12:44:16+00:00\" \/>\n<meta name=\"author\" content=\"liangqi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"liangqi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/liangqi.org\/?p=282#article\",\"isPartOf\":{\"@id\":\"https:\/\/liangqi.org\/?p=282\"},\"author\":{\"name\":\"liangqi\",\"@id\":\"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3\"},\"headline\":\"How to create a new repo in github?\",\"datePublished\":\"2022-02-18T22:37:18+00:00\",\"dateModified\":\"2022-02-26T12:44:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/liangqi.org\/?p=282\"},\"wordCount\":261,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3\"},\"articleSection\":[\"\u5de5\u5177\",\"\u6280\u672f\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/liangqi.org\/?p=282#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/liangqi.org\/?p=282\",\"url\":\"https:\/\/liangqi.org\/?p=282\",\"name\":\"How to create a new repo in github? - Liangqi\u2018s Technical Journey\",\"isPartOf\":{\"@id\":\"https:\/\/liangqi.org\/#website\"},\"datePublished\":\"2022-02-18T22:37:18+00:00\",\"dateModified\":\"2022-02-26T12:44:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/liangqi.org\/?p=282#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/liangqi.org\/?p=282\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/liangqi.org\/?p=282#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/liangqi.org\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create a new repo in github?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/liangqi.org\/#website\",\"url\":\"https:\/\/liangqi.org\/\",\"name\":\"Liangqi\u2018s Technical Journey\",\"description\":\"Chasing Excellence; Enjoy life.\",\"publisher\":{\"@id\":\"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/liangqi.org\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3\",\"name\":\"liangqi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/liangqi.org\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/liangqi.org\/wp-content\/uploads\/2022\/01\/P1100089-3-scaled.jpg\",\"contentUrl\":\"https:\/\/liangqi.org\/wp-content\/uploads\/2022\/01\/P1100089-3-scaled.jpg\",\"width\":2560,\"height\":1920,\"caption\":\"liangqi\"},\"logo\":{\"@id\":\"https:\/\/liangqi.org\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/liangqi.org\"],\"url\":\"https:\/\/liangqi.org\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create a new repo in github? - Liangqi\u2018s Technical Journey","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:\/\/liangqi.org\/?p=282","og_locale":"en_US","og_type":"article","og_title":"How to create a new repo in github? - Liangqi\u2018s Technical Journey","og_description":"If you write codes only for your job and don&#8217;t really try to have your personal little projects you may never create a brand new project in repo even you have been written codes for years. So how to create a new repo in gitbut sounds easy but a lot of experienced developers may never do that. Int he other hand, whether he\/she can create a repo without any trouble or google search is a arguable way to determine whether he\/she is a passionate developers or not (no argument needed here, personal option).. Ok. let&#8217;s start. Normally when you build a new repo you may use third part bootstrap tool to generate the template of the project. For example you may use spring initializr to do that: https:\/\/start.spring.io Init your local git repo: Login into github and create a new repo. Please make sure you don&#8217;t do the initial commit since it would make it conflict with local copy. You want to start from your local template from scratch. Since you have already created the repo locally, you just need to map it to the repo in github. Notes: Technically you don&#8217;t need to have a remote repo you can just init the local git repo which may be good enough if you feel it&#8217;s just a test project you are working on. People easily forget this if they come from the old fashion version control tool like SVN.. Discard all local changesgit reset; git checkout .;","og_url":"https:\/\/liangqi.org\/?p=282","og_site_name":"Liangqi\u2018s Technical Journey","article_published_time":"2022-02-18T22:37:18+00:00","article_modified_time":"2022-02-26T12:44:16+00:00","author":"liangqi","twitter_card":"summary_large_image","twitter_misc":{"Written by":"liangqi","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/liangqi.org\/?p=282#article","isPartOf":{"@id":"https:\/\/liangqi.org\/?p=282"},"author":{"name":"liangqi","@id":"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3"},"headline":"How to create a new repo in github?","datePublished":"2022-02-18T22:37:18+00:00","dateModified":"2022-02-26T12:44:16+00:00","mainEntityOfPage":{"@id":"https:\/\/liangqi.org\/?p=282"},"wordCount":261,"commentCount":0,"publisher":{"@id":"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3"},"articleSection":["\u5de5\u5177","\u6280\u672f"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/liangqi.org\/?p=282#respond"]}]},{"@type":"WebPage","@id":"https:\/\/liangqi.org\/?p=282","url":"https:\/\/liangqi.org\/?p=282","name":"How to create a new repo in github? - Liangqi\u2018s Technical Journey","isPartOf":{"@id":"https:\/\/liangqi.org\/#website"},"datePublished":"2022-02-18T22:37:18+00:00","dateModified":"2022-02-26T12:44:16+00:00","breadcrumb":{"@id":"https:\/\/liangqi.org\/?p=282#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/liangqi.org\/?p=282"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/liangqi.org\/?p=282#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/liangqi.org\/"},{"@type":"ListItem","position":2,"name":"How to create a new repo in github?"}]},{"@type":"WebSite","@id":"https:\/\/liangqi.org\/#website","url":"https:\/\/liangqi.org\/","name":"Liangqi\u2018s Technical Journey","description":"Chasing Excellence; Enjoy life.","publisher":{"@id":"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/liangqi.org\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/liangqi.org\/#\/schema\/person\/105c89d9b783fda67b62e3ce113d6cd3","name":"liangqi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/liangqi.org\/#\/schema\/person\/image\/","url":"https:\/\/liangqi.org\/wp-content\/uploads\/2022\/01\/P1100089-3-scaled.jpg","contentUrl":"https:\/\/liangqi.org\/wp-content\/uploads\/2022\/01\/P1100089-3-scaled.jpg","width":2560,"height":1920,"caption":"liangqi"},"logo":{"@id":"https:\/\/liangqi.org\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/liangqi.org"],"url":"https:\/\/liangqi.org\/?author=1"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/liangqi.org\/index.php?rest_route=\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liangqi.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liangqi.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liangqi.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/liangqi.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=282"}],"version-history":[{"count":5,"href":"https:\/\/liangqi.org\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":351,"href":"https:\/\/liangqi.org\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions\/351"}],"wp:attachment":[{"href":"https:\/\/liangqi.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liangqi.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/liangqi.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}