{"id":5983,"date":"2024-03-16T11:37:27","date_gmt":"2024-03-16T11:37:27","guid":{"rendered":"https:\/\/natsav.com\/blog\/?p=5983"},"modified":"2024-03-18T12:33:34","modified_gmt":"2024-03-18T12:33:34","slug":"push-existing-project-to-github","status":"publish","type":"post","link":"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/","title":{"rendered":"How to Push an Existing Project to GitHub"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_68_1 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#To_Push_an_Existing_Project_to_GitHub_follow_these_Steps\" title=\"To Push an Existing Project to GitHub, follow these Steps:\">To Push an Existing Project to GitHub, follow these Steps:<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#1_Create_a_GitHub_Repository_How_to_Create_Account_and_Repository_on_Github\" title=\"1. Create a GitHub Repository: \nHow to Create Account and Repository on Github\">1. Create a GitHub Repository: \nHow to Create Account and Repository on Github<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#2Navigate_to_Your_Project_Directory\" title=\"2.Navigate to Your Project Directory:\">2.Navigate to Your Project Directory:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#3Initialize_Git\" title=\"3.Initialize Git:\">3.Initialize Git:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#4Add_Your_GitHub_Repository_as_a_Remote\" title=\"4.Add Your GitHub Repository as a Remote:\">4.Add Your GitHub Repository as a Remote:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#5Add_Your_Files_to_the_Staging_Area\" title=\"5.Add Your Files to the Staging Area:\">5.Add Your Files to the Staging Area:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#6Commit_Your_Changes\" title=\"6.Commit Your Changes:\">6.Commit Your Changes:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#7Push_Your_Changes_to_GitHub\" title=\"7.Push Your Changes to GitHub:\">7.Push Your Changes to GitHub:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#8Enter_Your_GitHub_Credentials\" title=\"8.Enter Your GitHub Credentials:\">8.Enter Your GitHub Credentials:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/natsav.com\/blog\/push-existing-project-to-github\/#9Verify_on_GitHub\" title=\"9.Verify on GitHub:\">9.Verify on GitHub:<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"To_Push_an_Existing_Project_to_GitHub_follow_these_Steps\"><\/span><strong>To Push an Existing Project to GitHub, follow these Steps:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h4><span class=\"ez-toc-section\" id=\"1_Create_a_GitHub_Repository_How_to_Create_Account_and_Repository_on_Github\"><\/span><strong>1. Create a GitHub Repository:<br \/>\n<\/strong>How to Create Account and Repository on Github<strong><br \/>\n<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Log in to your <strong><a href=\"https:\/\/github.com\/\" target=\"_blank\" rel=\"noopener\">GitHub account<\/a><\/strong>.<\/p>\n<p>Click on the &#8220;+&#8221; icon in the top-right corner and select &#8220;New repository&#8221;.<\/p>\n<p>Name your repository, choose public or private, add a description, and adjust settings.<\/p>\n<p>Click &#8220;Create repository&#8221;.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2Navigate_to_Your_Project_Directory\"><\/span><strong>2.Navigate to Your Project Directory:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Open your terminal or command prompt.<\/p>\n<p>Use the cd command to go to your project directory.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3Initialize_Git\"><\/span><strong>3.Initialize Git:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If not already using Git, initialize a Git repository in your project directory:<br \/>\ngit init<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4Add_Your_GitHub_Repository_as_a_Remote\"><\/span><strong>4.Add Your GitHub Repository as a Remote:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Link your local repository to the GitHub repository you created:<br \/>\ngit remote add origin https:\/\/github.com\/\/.git<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5Add_Your_Files_to_the_Staging_Area\"><\/span><strong>5.Add Your Files to the Staging Area:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Use git add to add files to the staging area.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6Commit_Your_Changes\"><\/span><strong>6.Commit Your Changes:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Commit changes with a descriptive message:<br \/>\ngit commit -m &#8220;Initial commit&#8221;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7Push_Your_Changes_to_GitHub\"><\/span><strong>7.Push Your Changes to GitHub:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Push commits to the main branch of the <strong><a href=\"https:\/\/natsav.com\/blog\/create-repository-on-github\/\">GitHub repository<\/a><\/strong>:<br \/>\ngit push -u origin main<\/p>\n<h3><span class=\"ez-toc-section\" id=\"8Enter_Your_GitHub_Credentials\"><\/span><strong>8.Enter Your GitHub Credentials:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If prompted, enter your GitHub username and password or access token.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9Verify_on_GitHub\"><\/span><strong>9.Verify on GitHub:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Refresh your GitHub repository page to see your project files and commits.<\/p>\n<p>Your existing project is now on GitHub. Use git push to send updates to the remote repository.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To Push an Existing Project to GitHub, follow these Steps: 1. Create a GitHub Repository: How to Create Account and Repository on Github Log in to your GitHub account. Click on the &#8220;+&#8221; icon in the top-right corner and select &#8220;New repository&#8221;. Name your repository, choose public or private, add a description, and adjust settings. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[267],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5983"}],"collection":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/comments?post=5983"}],"version-history":[{"count":8,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5983\/revisions"}],"predecessor-version":[{"id":5991,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5983\/revisions\/5991"}],"wp:attachment":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/media?parent=5983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/categories?post=5983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/tags?post=5983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}