Git and GitHub
Installation and Configuration of Git
In this module, we will learn how to install Git on different operating systems and how to configure it to start working on your projects. The instructions below cover the most common operating systems: Windows, macOS, and Linux.
Git Installation
Windows
- Download Git: Visit git-scm.com and download the installer for Windows.
- Run the installer: Open the downloaded
.exe
file and follow the installation wizard instructions. - Configure options: During the installation, make sure to select these options:
- Default Editor: We recommend choosing Visual Studio Code or your preferred editor.
- Add Git to the system
PATH
: This will allow you to use Git from the command line or any terminal.
- Complete the installation: Finish the wizard and verify the installation.
bash
macOS
- Use Homebrew: If you already have Homebrew installed, simply run:
bash
- Verify installation: Open Terminal and verify the installation.
bash
Linux
- Ubuntu/Debian: Run these commands in the terminal:
bash
- Fedora: Use the following command:
bash
- Verify installation: In any distribution, verify the installation.
bash
Git Configuration
Once Git is installed, it is important to configure it before starting to use it. There are two essential configurations: your name and your email. These are associated with your commits.
Global Configuration
- Set username:
bash
- Set email:
bash
Verify configuration
To ensure your configuration is correct, you can verify the set values:
bash
Text Editor Configuration
Git uses a text editor for various tasks, such as writing commit messages. You can set your default editor with the following command:
bash
Color Configuration
To improve readability, you can enable colorization in Git's output:
bash
Alias Configuration
Aliases can make Git commands shorter and easier to remember. For example, you can create an alias for the git status
command:
bash
View Complete Configuration
To see the complete Git configuration on your system, you can use:
bash
With Git now installed and configured, you are ready to start using it in your projects. In the next module, we will explore the basics of version control and how Git implements them.
- Introduction to Git and GitHub
- Installation and Configuration of Git
- Version Control Fundamentals
- Repository Creation and Cloning
- Making Commits and Tracking Changes
- Branch Management (branching)
- Branch Merging (Merging)
- Conflict Resolution
- Collaborative Work on GitHub
- Pull Requests and Code Reviews
- Advanced Git Usage (rebase, cherry-pick, etc.)
- Automation with Git hooks
- Continuous Integration with GitHub Actions
- Version Management and Release Deployment
- Conclusions and Best Practices in Git and GitHub