{"id":3323,"date":"2013-02-26T08:20:00","date_gmt":"2013-02-26T08:20:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2013\/02\/26\/customize-git-settings-in-visual-studio\/"},"modified":"2019-02-14T17:54:41","modified_gmt":"2019-02-15T01:54:41","slug":"customize-git-settings-in-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/customize-git-settings-in-visual-studio\/","title":{"rendered":"Customize Git settings in Visual Studio"},"content":{"rendered":"<p><!--\n    \n        --><\/p>\n<p>\/\/<\/p>\n<p>By: <a href=\"http:\/\/social.msdn.microsoft.com\/profile\/andy%20lewis%20-%20msft\/\">Andy Lewis<\/a> and <a href=\"http:\/\/social.msdn.microsoft.com\/profile\/matthew%20mitrik%20(ms)\/\">Matthew Mitrik<\/a><\/p>\n<p>Today we&#8217;re here to help you:<\/p>\n<ul>\n<li>Specify how you identify yourself on the changes you commit<\/li>\n<li>Specify the default location for Git repositories<\/li>\n<li>Use images (from either TFS or Gravatar) to identify authors of commits<\/li>\n<li>Use a .gitignore file to block clutter from entering your user experience and your repository<\/li>\n<li>Use the .gitattributes file to make sure changes are correctly recognized by the system<\/li>\n<li>Modify Git settings from the command prompt<\/li>\n<\/ul>\n<p style=\"margin-bottom: 0\"><a class=\"expander\" style=\"padding: 5px;background-color: #dddddd;font-weight: bold\" href=\"#\">Got the latest version of Visual Studio with Git? If not, click here.<\/a><\/p>\n<div id=\"get-git\" class=\"expandable\" style=\"padding: 3px 5px 3px 15px;margin-left: 25px;background-color: #dddddd;margin-top: 0\">\n<p>To use the Visual Studio client tools you&#8217;ll need to <a href=\"http:\/\/go.microsoft.com\/fwlink\/p\/?LinkId=254509\">install Visual Studio 2012<\/a>, <a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=273878\">apply Visual Studio 2012 Update 2<\/a>, and finally <a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=275845\">install Visual Studio Tools for Git<\/a>. If you want to use Team Foundation Service, <a href=\"https:\/\/tfs.app.visualstudio.com\/_account\/Signup\">you can sign up for free<\/a>.<\/p>\n<\/div>\n<p>You can specify three kinds of Git settings, listed in order of supersedence:<\/p>\n<ul>\n<li><strong>Repository<\/strong> settings apply to the work done in the local repository.<\/li>\n<li><strong>Global<\/strong> settings apply to the work done by the current user on the dev machine.<\/li>\n<li><strong>System<\/strong> settings apply to all work done on the client dev machine. (Visual Studio respects these settings, but does not expose them.)<\/li>\n<\/ul>\n<p>For more details on Git settings, see <a href=\"http:\/\/git-scm.com\/book\/ch7-1.html\">Customizing Git &#8211; Git Configuration<\/a> and <a href=\"http:\/\/kernel.org\/pub\/software\/scm\/git\/docs\/git-config.html\">git-config command<\/a>.<\/p>\n<h2>Go to the page where you can tune your settings<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/2437.ViewTeamExplorer.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/7230.GitSettingsOpen.png\" alt=\"\" \/><\/p>\n<h2>Apply global dev machine settings<\/h2>\n<p>Global settings are scoped to each user on the client dev machine.&nbsp;So for example if you share a dev machine with Julia, then you and she can each have different settings.<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"vertical-align: top\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/7612.GitSettingsGlobal.png\" alt=\"\" \/><\/td>\n<td style=\"vertical-align: top;padding-left: 7px\">\n<p><strong>User Name<\/strong> and <strong>Email Address<\/strong>: Git associates each commit you create with your name and email address. When you first begin using Visual Studio with Git on your dev machine, if you begin by cloning from a Git team project, then Visual Studio fills these in for you.<\/p>\n<p><strong>Default Repository Location<\/strong>: You can specify the default root directory where you want to create or clone new local Git repositories.<\/p>\n<p><strong>Author images:<\/strong> You can use images to more easily see the author of each commit.<\/p>\n<ul>\n<li>\n<p style=\"margin-bottom: 0\">If your Git repo remote origin is in a TFS Git team project, team members can specify their images in their TFS profiles. <a class=\"expander\" style=\"padding: 2px;background-color: #dddddd;font-weight: bold\" href=\"#\">How?<\/a><\/p>\n<div id=\"set-tfs-profile-picture\" class=\"expandable\" style=\"padding: 3px 5px 3px 15px;margin-left: 25px;background-color: #dddddd;margin-top: 0\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/7673.GitSettingsTFSProfilePicture.png\" alt=\"\" \/><\/div>\n<\/li>\n<li style=\"margin-top: 6px\">If your Git repo remote origin is in a third-party Git service (such GitHub, Bitbucket, or CodePlex), select <strong>Enable download of author images from 3rd party source<\/strong>, and then ask team members to set up <a href=\"http:\/\/en.gravatar.com\/\">Gravatar<\/a> accounts for their email addresses.<\/li>\n<\/ul>\n<p><strong>Note:<\/strong> <strong>Enable download of author images from 3rd party source<\/strong> also works for TFS Git team projects in cases where the author has not supplied a profile image.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>An example of how author images enhance the collaborative experience:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/6557.GitSettingsAvatarExample.png\" alt=\"\" \/><\/p>\n<h2>Apply repository settings<\/h2>\n<p>Before you can modify Git repository settings, you must have a local Git repo opened in Team Explorer. See <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/02\/06\/set-up-connect-and-publish-using-visual-studio-with-git.aspx\">Create, connect, and publish using Visual Studio with Git<\/a>.<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"vertical-align: top\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/4174.GitSettingsRepo.png\" alt=\"\" \/><\/td>\n<td style=\"vertical-align: top;padding-left: 7px\">\n<p>Repository settings are scoped to each local Git repository on the dev machine. Typically you want to commit these files so that everyone else on your team uses the same repository settings on their dev machines.<\/p>\n<p><strong>Ignore File<\/strong>: To avoid checking in temporary non-source items such as binaries, you can specify a .gitignore file. See <a href=\"http:\/\/git-scm.com\/book\/en\/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files\">Ignoring files<\/a> and <a href=\"http:\/\/git-scm.com\/docs\/gitignore\">gitignore(5) Manual Page<\/a>.<\/p>\n<p><strong>Attributes File<\/strong>: To specify options such as how the system handles line-breaks, you can specify a .gitattributes file. See <a href=\"http:\/\/git-scm.com\/book\/en\/Customizing-Git-Git-Attributes\">Customizing Git &#8211; Git Attributes<\/a>.<\/p>\n<p style=\"margin-bottom: 0\"><a class=\"expander\" style=\"padding: 5px;background-color: #dddddd;font-weight: bold\" href=\"#\">Did you create your Git repo using Visual Studio 2012 QU2 CTP3 or earlier?<\/a><\/p>\n<div id=\"pre-CTP4-gitattributes\" class=\"expandable\" style=\"padding: 3px 5px 3px 15px;margin-left: 25px;background-color: #dddddd;margin-top: 0\">\n<p>Edit the .gitattributes file<\/p>\n<p>and look for this:<\/p>\n<pre>* -crlf<\/pre>\n<p>and if you find it, replace it with this:<\/p>\n<pre>* text=auto<\/pre>\n<p>(The first instruction normalizes line endings to CRLF in your working copy of the file when you modify it. We&#8217;ve determined that this isn&rsquo;t the recommended approach by the community. We recommend you use the second instruction instead.)<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td style=\"vertical-align: top\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/1351.GitSettingsRepoNone.png\" alt=\"\" \/><\/td>\n<td style=\"vertical-align: top;padding-left: 7px\">\n<p><strong>Tip:<\/strong> If your repository does not have these files, you really should use Visual Studio to add some default files that apply the most typically useful settings. Doing so will avoid distraction and potential clutter in your repo from non-source files such as locally-built binaries.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Commit your settings file changes<\/h2>\n<p>After you make changes to your repository settings files, you should commit them.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/5141.GitSettingsRepoCommit01.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/8875.GitSettingsRepoCommit02.png\" alt=\"\" \/><\/p>\n<h2>Modify Git settings from the command prompt<\/h2>\n<p>You can modify all Git settings from the command prompt using the git-config command.<\/p>\n<p>If you have not already done so, install the Git command-prompt tools.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/2821.GitSettingsCmdPrmptInstall.png\" alt=\"\" \/><\/p>\n<p>Open the command prompt.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/5483.GitSettingsCmdPrmptOpen.png\" alt=\"\" \/> <img decoding=\"async\" style=\"margin-left: 15px\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/02\/1856.GitSettingsCmdPrmptWindow.png\" alt=\"\" \/><\/p>\n<p>Enter the command. For info on the commands you can use, see <a href=\"http:\/\/git-scm.com\/book\/ch7-1.html\">Customizing Git &#8211; Git Configuration<\/a> and <a href=\"http:\/\/kernel.org\/pub\/software\/scm\/git\/docs\/git-config.html\">git-config command<\/a>.<\/p>\n<p>&lt;!&#8211;<\/p>\n<h1 class=\"header-title\">Customize Git settings in Visual Studio<\/h2>\n<p>&#8211;&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ By: Andy Lewis and Matthew Mitrik Today we&#8217;re here to help you: Specify how you identify yourself on the changes you commit Specify the default location for Git repositories Use images (from either TFS or Gravatar) to identify authors of commits Use a .gitignore file to block clutter from entering your user experience and [&hellip;]<\/p>\n","protected":false},"author":73,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[253,1,225],"tags":[],"class_list":["post-3323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-devops-server","category-devops","category-git"],"acf":[],"blog_post_summary":"<p>\/\/ By: Andy Lewis and Matthew Mitrik Today we&#8217;re here to help you: Specify how you identify yourself on the changes you commit Specify the default location for Git repositories Use images (from either TFS or Gravatar) to identify authors of commits Use a .gitignore file to block clutter from entering your user experience and [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/3323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=3323"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/3323\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=3323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=3323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=3323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}