![]() The command line to set mine is git config -global user.email " Instead, edit the email directive in the configuration file and provide your preferred address: email = last two settings that I like to set are the default branch name and the default editor. Your name and email address were configured automatically based In fact, if you have not configured them, Git will let you know with a friendly message the first time you commit: Committer: Alan If this is incorrect or you prefer something different, you can specify it in the configuration file. By default, Git uses your system-provided name and email address. The email address is the second directive, so let's update it. Instead of running this command, just edit the name directive in the configuration file: name = Alan Formy-Duval 3. The command line to set mine is git config -global user.name "Alan Formy-Duval". Name is the first directive in the file, so let's start with that. Now that we have opened the editor and Git has created the global configuration file behind the scenes, we can continue with the rest of the settings. # Please adapt and uncomment the following lines: If no file is found, Git will generate one with the following content and open it in your shell environment's default editor: # This is Git's per-user configuration file. Just use the -edit option: $ git config -global -edit Not to worry, let's skip the searching and get started. If you have just started using Git, you may not have this file at all. Git provides an even more efficient and convenient way to directly edit your global configuration file-that is the first item on my list! 1. This is time-consuming and prone to human error. $ git config -global user.email cat ~/.gitconfigĮmail = downside here is if you have a large list of preferred settings, you will have a lot of commands to enter. Remember, the tilde (~) character represents your home directory. The -global option will instruct Git to write the email address to the global configuration file ~/.gitconfig, even creating it if necessary: I can avoid this repetition by setting it globally. The process must be repeated for new repositories. Plus, when this command is run within a Git repository, it only configures that specific one. ![]() However, this will only take effect if you are in an existing Git directory: $ git config user.email not in a git directory You can set it by running git config user.email followed by your email address. For example, a common item to set is your email address. Git offers the git config command for manual configuration but this is a lot of work with certain caveats. I like to take advantage of the global configuration capability of Git. Not many, but enough that I don't want to have to repeat the configuration each time. There are certain general settings that I always want. ![]()
0 Comments
Leave a Reply. |