{"id":8816,"date":"2016-09-02T15:08:35","date_gmt":"2016-09-02T13:08:35","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/"},"modified":"2016-09-02T15:08:35","modified_gmt":"2016-09-02T13:08:35","slug":"initiate-a-local-git-repository-in-command-line","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/","title":{"rendered":"Initiate a local GIT repository in command line"},"content":{"rendered":"<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10550\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git.png\" alt=\"GIT\" width=\"225\" height=\"225\" \/><\/a><\/p>\n<p>Objective of the document is to describe how to start manually with command lines a development project, from an existing GIT repository.<\/p>\n<p>Usage of GIT protocol for software development empowers projects team management. It is intended to ease source code management in terms of versioning, branching and sharing between all team members.<\/p>\n<p><strong>\u00a0\u00a0\u00a0 GIT platform Architecture<\/strong><\/p>\n<p>GIT is a distributed version control system, it means developers can share source code from their workstation to others without the need of any centralized repository. However, at dbi-services we made the choice to deploy a centralized repository platform, first in order to avoid manual synchronization between all developers, then to benefit from a shared common project collaboration platform, like GitHub or GitLab.<\/p>\n<p>Prior being allowed to make a push request to centralized repository, a developer must first ensure having got latest source code revision into its local workstation\u2019s repository (pull request). Then he can commit locally his changes, eventually correct merge conflicts, and finally make the push request to centralized platform.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Git_Archi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-10551\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Git_Archi.png\" alt=\"GIT Architecture\" width=\"340\" height=\"340\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u00a0\u00a0\u00a0 Manual \/ Command line management<\/strong><\/p>\n<p>This section will demonstrate how to initiate developer\u2019s local source code management with a remote GIT repository, (as well as from a collaboration platform like GitLab), using the command line.<\/p>\n<p>These commands run out of the box in a Linux operating system.<br \/>\nUnder Windows, you must install \u201c<strong>git-bash<\/strong>\u201d application.<\/p>\n<p>There are 2 cases for a project initialization:<\/p>\n<p>&#8211;\u00a0\u00a0 \u00a0Starting a project from your source code<br \/>\n&#8211;\u00a0\u00a0 \u00a0Getting source code from a shared repository<\/p>\n<p>First of all a GIT repository has to be created in the GIT collaboration platform. Do ask GIT platform\u2019s administrators for project creation.<\/p>\n<p>Before starting, it is recommended to update your GIT personal information:<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">git config <span style=\"color: #308080;\">&#8211;<\/span><span style=\"color: #308080;\">&#8211;<\/span>global user<span style=\"color: #308080;\">.<\/span>name <span style=\"color: #800000;\">&#8220;<\/span><span style=\"color: #1060b6;\">user<\/span><span style=\"color: #800000;\">&#8220;<\/span><br \/>\ngit config <span style=\"color: #308080;\">&#8211;<\/span><span style=\"color: #308080;\">&#8211;<\/span>global user<span style=\"color: #308080;\">.<\/span>email <span style=\"color: #800000;\">&#8220;<\/span><span style=\"color: #1060b6;\">user@xxx.com<\/span><span style=\"color: #800000;\">&#8220;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Check status of your GIT configuration:<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">git config \u2013list<\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Project initialization from local source code<\/strong><\/p>\n<p>First you must go to your project folder. It is recommended to have the \u201csrc\u201d folder underneath.<\/p>\n<p>GIT repository initialization:<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">git init<\/p>\n<p>&nbsp;<\/p>\n<p>Create a \u201cmaster\u201d branch on your local and on remote GIT repository<\/p>\n<p>For local branch creation, you will need to add and commit something (like a README.txt file):<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">git add README<span style=\"color: #308080;\">.<\/span>txt<br \/>\ngit commit <span style=\"color: #308080;\">&#8211;<\/span>m <span style=\"color: #800000;\">&#8220;<\/span><span style=\"color: #1060b6;\">adding README.txt<\/span><span style=\"color: #800000;\">&#8220;<\/span><br \/>\ngit branch<br \/>\n<span style=\"color: #308080;\">* master<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>For remote branch creation, you must first create the local branch, add the remote repository \u201corigin\u201d, then make a pull request to shared repository:<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">git remote add origin http<span style=\"color: #406080;\">:<\/span><span style=\"color: #595979;\">\/\/&lt;your git server&gt;\/&lt;your repo&gt;.git<\/span><br \/>\ngit push origin master<\/p>\n<p>\u201corigin\u201d represents a pointer name to remote repository.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Project initialization getting source code from shared repository<\/strong><\/p>\n<p>Get source code from the repository:<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">git clone http<span style=\"color: #406080;\">:<\/span><span style=\"color: #595979;\">\/\/&lt;your git server&gt;\/&lt;your repo&gt;.git &lt;your destination folder&gt;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Congratulations, you are now ready to use GIT with your new project !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Objective of the document is to describe how to start manually with command lines a development project, from an existing GIT repository. Usage of GIT protocol for software development empowers projects team management. It is intended to ease source code management in terms of versioning, branching and sharing between all team members. \u00a0\u00a0\u00a0 GIT platform [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":8819,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[],"type_dbi":[],"class_list":["post-8816","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Initiate a local GIT repository in command line - dbi Blog<\/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:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Initiate a local GIT repository in command line\" \/>\n<meta property=\"og:description\" content=\"Objective of the document is to describe how to start manually with command lines a development project, from an existing GIT repository. Usage of GIT protocol for software development empowers projects team management. It is intended to ease source code management in terms of versioning, branching and sharing between all team members. \u00a0\u00a0\u00a0 GIT platform [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-02T13:08:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"225\" \/>\n\t<meta property=\"og:image:height\" content=\"225\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Middleware Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Middleware Team\" \/>\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:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/\"},\"author\":{\"name\":\"Middleware Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"headline\":\"Initiate a local GIT repository in command line\",\"datePublished\":\"2016-09-02T13:08:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/\"},\"wordCount\":484,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png\",\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/\",\"name\":\"Initiate a local GIT repository in command line - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png\",\"datePublished\":\"2016-09-02T13:08:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png\",\"width\":225,\"height\":225},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Initiate a local GIT repository in command line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\",\"name\":\"Middleware Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"caption\":\"Middleware Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Initiate a local GIT repository in command line - dbi Blog","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:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/","og_locale":"en_US","og_type":"article","og_title":"Initiate a local GIT repository in command line","og_description":"Objective of the document is to describe how to start manually with command lines a development project, from an existing GIT repository. Usage of GIT protocol for software development empowers projects team management. It is intended to ease source code management in terms of versioning, branching and sharing between all team members. \u00a0\u00a0\u00a0 GIT platform [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/","og_site_name":"dbi Blog","article_published_time":"2016-09-02T13:08:35+00:00","og_image":[{"width":225,"height":225,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png","type":"image\/png"}],"author":"Middleware Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Middleware Team","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/"},"author":{"name":"Middleware Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"headline":"Initiate a local GIT repository in command line","datePublished":"2016-09-02T13:08:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/"},"wordCount":484,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png","articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/","url":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/","name":"Initiate a local GIT repository in command line - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png","datePublished":"2016-09-02T13:08:35+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/git-1.png","width":225,"height":225},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/initiate-a-local-git-repository-in-command-line\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Initiate a local GIT repository in command line"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1","name":"Middleware Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","caption":"Middleware Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/8816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=8816"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/8816\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/8819"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=8816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=8816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=8816"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=8816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}