Jose Robledo
04 March 2025
When we use Git on a new computer for the first time, we need to configure a few things. Below are a few examples of configurations we will set as we get started with Git:
The user name and email will be associated with your subsequent Git activity, which means that any changes pushed to a remote server will include this information.
For this lesson, we will be interacting with GitHub and so the email address used should be the same as the one used when setting up your GitHub account.
Let’s configure our git with our own name and email
$ git config --global user.name "Alfredo Linguini"
$ git config --global user.email "a.linguini@ratatouille.fr"
The flag --global
tells Git to use the settings for
every project, in your user account, on this computer.
As with other keys, when you press Enter or ↵ or return (Mac) on your keyboard, your computer encodes this input as a character. Different operating systems use different character(s) to represent the end of a line. (You may also hear these referred to as newlines or line breaks.) Because Git uses these characters to compare files, it may cause unexpected issues when editing a file on different machines.
You can change the way Git recognizes and encodes line endings using
the core.autocrlf
command to git config
. The
following settings are recommended:
On macOS and Linux:
And on Windows:
Editor | Configuration command |
---|---|
Atom | $ git config --global core.editor "atom --wait" |
nano | $ git config --global core.editor "nano -w" |
BBEdit (Mac, with command line tools) | $ git config --global core.editor "bbedit -w" |
Sublime Text (Mac) | $ git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w" |
Sublime Text (Win, 32-bit install) | $ git config --global core.editor "'c:/program files (x86)/sublime text 3/sublime_text.exe' -w" |
Sublime Text (Win, 64-bit install) | $ git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w" |
Notepad (Win) | $ git config --global core.editor "c:/Windows/System32/notepad.exe" |
Notepad++ (Win, 32-bit install) | $ git config --global core.editor "'c:/program files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" |
Notepad++ (Win, 64-bit install) | $ git config --global core.editor "'c:/program files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" |
Kate (Linux) | $ git config --global core.editor "kate" |
Gedit (Linux) | $ git config --global core.editor "gedit --wait --new-window" |
Scratch (Linux) | $ git config --global core.editor "scratch-text-editor" |
Emacs | $ git config --global core.editor "emacs" |
Vim | $ git config --global core.editor "vim" |
VS Code | $ git config --global core.editor "code --wait" |
Comment 1: Note that Vim is the default editor for
many programs. If you haven’t used Vim before and wish to exit a session
without saving your changes, press Esc then type
:q!
and press Enter or ↵ or on Macs,
Return. If you want to save your changes and quit, press
Esc then type :wq
and press Enter or
↵ or on Macs, Return. the Esc
button
ensures you that you are out of any insert mode, :
allows
to specify a vim command, q
stands for quit, w
for write, and q!
forces to quit without saving.
Comment 2: Inline text editors are important and very useful!!! Try getting a hand of one of them.
Source file changes are associated with a “branch.” For new learners
in this lesson, it’s enough to know that branches exist, and this lesson
uses one branch.
By default, Git will create a branch called master
when you
create a new repository with git init
(we will see this
soon). This term evokes the racist practice of human slavery and the software development
community has moved to adopt more inclusive language.
In case of needing to edit it:
To disable the proxy, use
Content