By: Andy Lewis and Matthew Mitrik
Today we'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 Gravatar to identify authors of commits
- Use a .gitignore file to block clutter from entering your user experience and your repository
- Use the .gitattributes file to make sure changes are correctly recognized by the system
- Modify Git settings from the command prompt
Got the latest version of Visual Studio with Git? If not, click here.
You can specify three kinds of Git settings, listed in order of supersedence:
- Repository settings apply to the work done in the local repository.
- Global settings apply to the work done by the current user on the dev machine.
- System settings apply to all work done on the client dev machine. (Visual Studio respects these settings, but does not expose them.)
For more details on Git settings, see Customizing Git - Git Configuration and git-config command.
Go to the page where you can tune your settings
Apply global dev machine settings
Global settings are scoped to each user on the client dev machine. So for example if you share a dev machine with Julia, then you and she can each have different settings.
User Name and Email Address: 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. Default Repository Location: You can specify the default root directory where you want to create or clone new local Git repositories. Enable download of author images from 3rd party source: Visual Studio can show you author images on commits. By default the system uses the image from the user's TFS profile. If you select this option, If the author shown doesn't have an image in their TFS profile, or if you are working with a repository whose remote origin is a third-party service such GitHub, Bitbucket, or CodePlex, an image from Gravatar will be used.
|
Apply repository settings
Before you can modify Git repository settings, you must have a local Git repo opened in Team Explorer. See Create, connect, and publish using Visual Studio with Git.
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. Ignore File: To avoid checking in temporary non-source items such as binaries, you can specify a .gitignore file. See Ignoring files and gitignore(5) Manual Page. Attributes File: To specify options such as how the system handles line-breaks, you can specify a .gitattributes file. See Customizing Git - Git Attributes. Did you create your Git repo using Visual Studio 2012 QU2 CTP3 or earlier? |
Tip: 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. |
Commit your settings file changes
After you make changes to your repository settings files, you should commit them.
Modify Git settings from the command prompt
You can modify all Git settings from the command prompt using the git-config command.
If you have not already done so, install the Git command-prompt tools.
Open the command prompt.
Enter the command. For info on the commands you can use, see Customizing Git - Git Configuration and git-config command.