{"id":1075,"date":"2023-08-29T23:22:37","date_gmt":"2023-08-29T17:52:37","guid":{"rendered":"https:\/\/www.openwriteup.com\/?page_id=1075"},"modified":"2024-05-27T16:35:18","modified_gmt":"2024-05-27T11:05:18","slug":"git-labs-basic-commands","status":"publish","type":"page","link":"https:\/\/www.openwriteup.com\/?page_id=1075","title":{"rendered":"git labs basic commands"},"content":{"rendered":"<ol>\n<li>login to ubuntu system as root user:<\/li>\n<\/ol>\n<pre>sudo su -\u00a0\r\n\/\/It will prompt for password, provide the same password of ubuntu server<\/pre>\n<p>2.\u00a0 check the git version<\/p>\n<pre>git --version<\/pre>\n<p>3. set the global parameter<\/p>\n<pre>1. git config --global user.name \"&lt;your-firstname&gt; &lt;your-lastname&gt;\"\r\n2. git config --global user.email \"&lt;your-email@address&gt;\"\r\nEXAMPLES:\r\n\u00a0git config --global user.name \"amit\"\r\ngit config --global user.email \"amit@ow.com\"\r\ngit config --global --list \r\nexport EDITOR=vi<\/pre>\n<p>4. Create and initialize a local Git repo<\/p>\n<pre>#Change to your home directory\r\ncd ~\r\n\u00a0#Create a new directory, which we will initialize as git-enabled\r\nmkdir my-repo\r\n\u00a0#Change into the new directory\r\ncd my-repo\r\n#Check the current git status of the new directory\r\ngit status\r\n#Initialize the directory as a git-enabled\r\ngit init\r\nls -al\r\ngit status<\/pre>\n<p>5.git commands<\/p>\n<p>#Change the directory to my-repo and Add a file using touch command<\/p>\n<pre>touch Readme\r\n# check the git status\r\ngit status\r\n#Under \u2018Untracked files\u2019 you should see \u201cReadme\u201d, showing that this file has been changed but has not yet been added\r\n# Add the README file to the Git staging area\u00a0\r\ngit add Readme\r\ngit status\r\n#commit the file, -m option to add message while committing\r\ngit commit -m \"Adding file\"\r\ngit status\r\n#Run git log, to see the commit history\r\ngit log<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>login to ubuntu system as root user: sudo su &#8211;\u00a0 \/\/It will prompt for password, provide the same password of ubuntu server 2.\u00a0 check the git version git &#8211;version 3. set the global parameter 1. git config &#8211;global user.name &#8220;&lt;your-firstname&gt; &lt;your-lastname&gt;&#8221; 2. git config &#8211;global user.email &#8220;&lt;your-email@address&gt;&#8221; EXAMPLES: \u00a0git config &#8211;global user.name &#8220;amit&#8221; git config [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_oct_exclude_from_cache":false,"footnotes":""},"class_list":["post-1075","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages\/1075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1075"}],"version-history":[{"count":2,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages\/1075\/revisions"}],"predecessor-version":[{"id":1471,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages\/1075\/revisions\/1471"}],"wp:attachment":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}