{"componentChunkName":"component---src-templates-blog-post-js","path":"/git/","result":{"data":{"site":{"siteMetadata":{"title":"Recipes Collection","author":"Internet Community"}},"markdownRemark":{"id":"914632d4-1f5a-55a8-aa33-7559ff894681","html":"<ul>\n<li>\n<p><a href=\"#configure-your-git-usernameemail\">Configure your Git username/email</a></p>\n<ul>\n<li><a href=\"#to-set-your-global-usernameemail-configuration\">To set your global username/email configuration</a></li>\n<li><a href=\"#to-set-repository-specific-usernameemail-configuration\">To set repository-specific username/email configuration:</a></li>\n</ul>\n</li>\n<li>\n<p><a href=\"#gitignore-file\">.gitignore file</a></p>\n<ul>\n<li><a href=\"#add-global-gitignore-file\">Add global .gitignore file</a></li>\n<li><a href=\"#git-command-to-show-which-specific-files-are-ignored-by-gitignore\">Git command to show which specific files are ignored by .gitignore</a></li>\n<li><a href=\"#check-which-gitignore-file-is-responsible-for-ignoring-the-file\">Check which .gitignore file is responsible for ignoring the file.</a></li>\n</ul>\n</li>\n</ul>\n<h2 id=\"configure-your-git-usernameemail\"><a href=\"#configure-your-git-usernameemail\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Configure your Git username/email</h2>\n<h3 id=\"to-set-your-global-usernameemail-configuration\"><a href=\"#to-set-your-global-usernameemail-configuration\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>To set your global username/email configuration</h3>\n<ul>\n<li>Open the command line.</li>\n<li>Set your username:\n<code class=\"language-text\">git config --global user.name &quot;FIRST_NAME LAST_NAME&quot;</code></li>\n<li>Set your email address:\n<code class=\"language-text\">git config --global user.email &quot;MY_NAME@example.com&quot;</code></li>\n</ul>\n<h3 id=\"to-set-repository-specific-usernameemail-configuration\"><a href=\"#to-set-repository-specific-usernameemail-configuration\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>To set repository-specific username/email configuration:</h3>\n<ul>\n<li>From the command line, change into the repository directory.</li>\n<li>Set your username:\n<code class=\"language-text\">git config user.name &quot;FIRST_NAME LAST_NAME&quot;</code></li>\n<li>Set your email address:\n<code class=\"language-text\">git config user.email &quot;MY_NAME@example.com&quot;</code></li>\n<li>Verify your configuration by displaying your configuration file:\n<code class=\"language-text\">cat .git/config</code></li>\n</ul>\n<p>Reference</p>\n<ul>\n<li><a href=\"https://support.atlassian.com/bitbucket-cloud/docs/configure-your-dvcs-username-for-commits/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://support.atlassian.com/bitbucket-cloud/docs/configure-your-dvcs-username-for-commits/</a></li>\n</ul>\n<h2 id=\"gitignore-file\"><a href=\"#gitignore-file\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>.gitignore file</h2>\n<h3 id=\"add-global-gitignore-file\"><a href=\"#add-global-gitignore-file\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Add global .gitignore file</h3>\n<ol>\n<li>Open Terminal.</li>\n<li>Run <code class=\"language-text\">touch ~/.gitignore</code> - this will create global.gitignore file in your home directory.</li>\n<li>\n<p>Add some values that you would like to always ignore. </p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token comment\"># OS generated files #</span>\n<span class=\"token comment\">######################</span>\n.DS_Store</code></pre></div>\n</li>\n<li>Run <code class=\"language-text\">git config --global core.excludesfile ~/.gitignore</code>. According to this page at git-scm.com this command will make all the patterns from <code class=\"language-text\">~/.gitignore</code> ignored in all situations.</li>\n</ol>\n<p>Reference - <a href=\"http://egorsmirnov.me/2015/05/04/global-gitignore-file.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">http://egorsmirnov.me/2015/05/04/global-gitignore-file.html</a></p>\n<h3 id=\"git-command-to-show-which-specific-files-are-ignored-by-gitignore\"><a href=\"#git-command-to-show-which-specific-files-are-ignored-by-gitignore\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Git command to show which specific files are ignored by .gitignore</h3>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">git</span> status --ignored</code></pre></div>\n<p>Reference - <a href=\"https://stackoverflow.com/a/12080920\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://stackoverflow.com/a/12080920</a></p>\n<h3 id=\"check-which-gitignore-file-is-responsible-for-ignoring-the-file\"><a href=\"#check-which-gitignore-file-is-responsible-for-ignoring-the-file\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Check which .gitignore file is responsible for ignoring the file.</h3>\n<p>Using above <code class=\"language-text\">git status --ignored</code> command find out which files are ignored. Then use below to command to see which .gitignore file is responsible for ignoring that file.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">git</span> check-ignore -v <span class=\"token punctuation\">..</span>/<span class=\"token punctuation\">..</span>/.DS_Store</code></pre></div>\n<p>Reference - <a href=\"https://riptutorial.com/git/example/2209/checking-if-a-file-is-ignored\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://riptutorial.com/git/example/2209/checking-if-a-file-is-ignored</a></p>","timeToRead":2,"frontmatter":{"title":"Git","date":null,"spoiler":null},"fields":{"slug":"/git/","langKey":"en"}}},"pageContext":{"slug":"/git/","previous":{"fields":{"slug":"/miscellaneous/","langKey":"en","directoryName":"miscellaneous","maybeAbsoluteLinks":[]},"frontmatter":{"title":"Miscellaneous"}},"next":null,"translations":[],"translatedLinks":[]}}}