IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact
You are here: Home / How To / Basic Configuration in Git

Basic Configuration in Git

After installing Git, you may want to do some basic configuration so you can have a proper versioning history and collaborate with others in a shared repository.

First thing, you want to do before anything is to set your name and email.

You can open Git Bash on Windows or Terminal for macOS.

Replacing the First, Last and email address with your own, type the following:

git config --global user.name "First Last"
git config --global user.email myemail@itnota.com

This will be useful when you collaborate with others to see who has made what changes in the repository.

The next one, you want to set how the end of the line is treated in Git. This is often overlooked by many and usually does not pose any issues if everyone uses the same system or you just use Git by yourself. However if you check in and out your code using different platforms, it can cause an issue.

A bit of explanation with the end of the line for each OS here. On Windows an end of line consists of two characters \r\n which is a carriage return followed by a line feed. macOS on the other hand, only uses \n (line feed) and no carriage return. As such, whenever someone checks code in or out, Git needs to know how to treat the line ends so everyone will have consistent experience. So we have to configure the core.autocrlf accordingly.

Windows

For Windows, typically when you accept default settings from Git installer, it will set it automatically to true. But just in case you checked the wrong option or you wanted to be sure, you can configure it manually.

Type the following in Git Bash:

git config --global core.autocrlf = true

macOS

For macOS, type the following in Terminal:

git config --global core.autocrlf = input

Git global config for core.autocrlf in macOS Terminal

Now you can verify all your configuration settings by typing this command:

git config --global --list

If you found any typo, you can always fix it by running the same command line with the correct information.

That’s it. This configuration typically is done just once.

Next, while optional, you might want to check this post if you want to use your favorite text editor as the default.

Further Reading

How to Use Your Favorite Text Editor in Git
Git git-config Documentation
How to Install Git

October 14, 2021 Filed Under: How To Tagged With: Git

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to Check Installed .NET Framework Version
  • How to Remove .NET Runtime and SDK on Mac
  • How to Solve Intermittent 403 Error in IIS
  • How to Show Hidden Folders and Files in Mac Finder
  • How to Solve MS Office VBA Compile Error UserAuthentication

Recent Posts

  • How to Check Installed .NET Framework Version
  • How to Remove .NET Runtime and SDK on Mac
  • How to Solve Intermittent 403 Error in IIS
  • How to Show Hidden Folders and Files in Mac Finder
  • How to Solve MS Office VBA Compile Error UserAuthentication
  • RSS

Tags

.NET Access Amazon ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC Office PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows Server

Copyright © 2011-2022 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure