﻿{"id":53820,"date":"2023-10-19T12:33:13","date_gmt":"2023-10-19T12:33:13","guid":{"rendered":"https:\/\/www.bookwormhead.com\/?p=53820"},"modified":"2023-10-19T12:33:13","modified_gmt":"2023-10-19T12:33:13","slug":"how","status":"publish","type":"post","link":"https:\/\/bookwormhead.com\/cms\/how\/","title":{"rendered":"How Clone Repository in Github"},"content":{"rendered":"<p>How to pull [clone repo] files from github repo to local git<br \/>\nhow to pull files from local to repo<\/p>\n<p>how to create branches and delete<\/p>\n<p>**bold text**<\/p>\n<p>### 1. Clone the repo<\/p>\r\n    <div class=\"bwh-in-article-ad\">\r\n      <ins class=\"adsbygoogle\"\r\n           style=\"display:block; text-align:center;\"\r\n           data-ad-client=\"ca-pub-4299086769596754\"\r\n           data-ad-slot=\"8699383760\"\r\n           data-ad-format=\"auto\"\r\n           data-full-width-responsive=\"true\"><\/ins>\r\n      <script>\r\n        (adsbygoogle = window.adsbygoogle || []).push({});\r\n      <\/script>\r\n    <\/div>\n<p>`git clone https:\/\/github.com\/anj-bookwormhead\/test12.git`<\/p>\n<p>2. Authenticate your account<\/p>\n<p>&#8220;`git config &#8211;global user.email info.samthing@gmail.com`<br \/>\ngit config &#8211;global user.name anj-bookwormhead&#8220;`<\/p>\n<p>### 3. initiliaze the files in from your local computer to github<\/p>\r\n    <div class=\"bwh-in-article-ad\">\r\n      <ins class=\"adsbygoogle\"\r\n           style=\"display:block; text-align:center;\"\r\n           data-ad-client=\"ca-pub-4299086769596754\"\r\n           data-ad-slot=\"8699383760\"\r\n           data-ad-format=\"auto\"\r\n           data-full-width-responsive=\"true\"><\/ins>\r\n      <script>\r\n        (adsbygoogle = window.adsbygoogle || []).push({});\r\n      <\/script>\r\n    <\/div>\n<p>&#8220;`echo &#8220;# test12&#8221; &gt;&gt; README.md<br \/>\ngit init<br \/>\n&#8220;`<\/p>\n<p>### 4. publish the files to github<\/p>\n<p>poin the cli to the right directory.<\/p>\n<p>&#8220;`git branch -M main &#8220;`<br \/>\nFor the main &#8211; you can select which branch tag you want to add the files.<\/p>\n<p>`git remote add origin https:\/\/github.com\/anj-bookwormhead\/test12.git`<br \/>\ngit push -u origin main<\/p>\n<p>Add a documents to cli to github<\/p>\n<p>If you want to add all the files, use .<br \/>\n&#8220;`<br \/>\ngit add .<br \/>\ngit commit -m &#8220;2nd commit&#8221;<br \/>\ngit push origin main<br \/>\n&#8220;`<\/p>\n<p>If you want to add specific file.<br \/>\n&#8220;`<br \/>\ngit add README.md<br \/>\ngit add test2.txt<br \/>\ngit commit -m &#8220;2nd commit&#8221;<br \/>\n&#8220;`<\/p>\n<p>### \u2026or use remote if the files are not cloone in github<\/p>\n<p>git remote add origin https:\/\/github.com\/anj-bookwormhead\/angelic1241029.git<br \/>\ngit branch -M main<br \/>\ngit push -u origin main<\/p>\n<p>_________________________________________________________<\/p>\n<p>Option 2: Use this if the files are clone in github<br \/>\nIF you encounter an error<\/p>\n<p>**$ git remote add origin https:\/\/github.com\/anj-bookwormhead\/test12.git<br \/>\nerror: remote origin already exists.**<\/p>\n<p>Check the if there&#8217;s a origin existing<br \/>\n$ git remote &#8211;verbose<\/p>\n<p>origin https:\/\/github.com\/anj-bookwormhead\/test12.git (fetch)<br \/>\norigin https:\/\/github.com\/anj-bookwormhead\/test12.git (push)<\/p>\n<p>git push https:\/\/github.com\/anj-bookwormhead\/test12.git<\/p>\n<p>git remote set-url origin https:\/\/github.com\/anj-bookwormhead\/clonerepo2.git<\/p>\n<p>## **Github** Branch<\/p>\n<p>&#8220;` $ git branch -a&#8220;`<\/p>\n<p>**Result example**<\/p>\n<p>&#8220;`<br \/>\n* main<br \/>\n* new-branch<br \/>\n* old-branch<br \/>\n&#8220;`<\/p>\n<p>**Delete local branch**<\/p>\n<p>&#8220;git branch &#8211;delete or<br \/>\n&#8220;git branch -d mybranch<\/p>\n<p>**Delete remote branch**<br \/>\n&#8220;git push origin &#8211;delete oldbranch&#8220;<\/p>\n<p>It create and switch to the new branch you created<br \/>\n&#8220;git switch -c mybranch&#8220;<\/p>\n<p>Just switch to other brand<\/p>\n<p>&#8220;git switch main<\/p>\n<p>&#8220;<\/p>","protected":false},"excerpt":{"rendered":"<p>How to pull [clone repo] files from github repo to local git how to pull files from local to repo how to create branches and delete **bold text** ### 1. Clone the repo `git clone https:\/\/github.com\/anj-bookwormhead\/test12.git` 2. Authenticate your account &#8220;`git config &#8211;global user.email info.samthing@gmail.com` git config &#8211;global user.name anj-bookwormhead&#8220;` ### 3. initiliaze the files [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-53820","post","type-post","status-publish","format-standard","hentry","category-design"],"_links":{"self":[{"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/posts\/53820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/comments?post=53820"}],"version-history":[{"count":0,"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/posts\/53820\/revisions"}],"wp:attachment":[{"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/media?parent=53820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/categories?post=53820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bookwormhead.com\/cms\/wp-json\/wp\/v2\/tags?post=53820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}