DEV Community

mary thandy
mary thandy

Posted on

Understanding Git and GitHub for Beginners

Before diving into modern software development, it is essential to master the tools that power global collaboration and code management. Whether you are beginning your programming journey or curious about how professional teams build real-world software, Git and GitHub are foundational skills you simply cannot overlook.

What is Git

Git is a version control system/software on your computer that tracks every change that is used to track changes. This tool is used mostly by software developers, its helps them trace easily any changes made or errors on projects. It also makes it possible for multiple people to work on the same project simultaneously using branches thus avoiding code overlapping. It can be used as a backup where historical projects can be locally saved.

What is GitHub?

Github is a web -based platform designed to help developers, collaborate and manage projects with ease. It also helps to store code. Github serves as a portfolio for coding projects. It also allows developers from all around the world to contribute to your project.

Hope we are still together , lets continue with the learning

What is the difference between Git and GitHub?

GitHub Git
Provides collaboration and project management tools Tracks changes in code
Requires an internet connection to access repositories Operates locally on your machine
Cloud-based hosting platform for Git repositories Version control system

Prerequisites for Using Git

Before you can start using Git on your machine, you need to ensure it is properly installed based on your operating system:

  • Windows: Download and install Git Bash. This provides a Unix-style command-line experience which is the standard for Git operations.
  • macOS / Linux: Open your Terminal. Git is often pre-installed, but if it isn't, you can install it using your system's package manager (e.g., brew install git for Mac or sudo apt install git for Linux).

Pro-Tip

To check if Git is already installed and ready to go, type the following command in your terminal or Git Bash:

git --version

Configure Your Identity

Once Git is installed, the first thing you should do is set your identity. Git attaches this information to every commit you make to track who made specific changes. You can configure your global username and email address by running the following commands:

git config --global user.name "Your Name"

'git config --global user.email "your_email@example.com"
`
Ensure to change “Your Name” and “your_email@example.com” to match your details. To ensure everything is saved correctly, you can list your active settings by running:

git config --list

When you run that command, Git will return a list of settings. It should look something like this:

user.name=Your Name
user.email=your_email@example.com
...

Understanding SSH Keys

An SSH key is a secure access credential used by the Secure Shell (SSH) protocol. It provides a more secure and scalable way to authenticate your machine with GitHub than using a standard password.

SSH authentication relies on a pair of keys:

  • Public Key: Shared with services like GitHub. It acts like a "lock."
  • Private Key: Kept strictly on your local machine. It acts like the "physical key" to that lock.
Generating a New SSH Key

Open your Git Bash (Windows) or Terminal (Mac/Linux) and run the following command to generate a modern, high-security key:

ssh-keygen -t ed25519 -C "your_email@example.com"

Note: When prompted to "Enter a file in which to save the key," simply press Enter to accept the default location.

Adding the Key to Your GitHub Account

To link your machine to GitHub, you must copy your Public Key and add it to your GitHub settings.

  • View your public key: Run the following command to display the key text: cat ~/.ssh/id_ed25519.pub
  • Copy the output: Highlight the entire text starting with ssh-ed25519 and ending with your email.
  • Add to GitHub: Go to GitHub Settings > SSH and GPG keys > New SSH Key, then paste your key into the "Key" field.
Verifying the Connection

Finally, test the connection to ensure everything is configured correctly by running:

ssh -T git@github.com

If successful, you will receive a confirmation message:

"Hi [YourUsername]! You've successfully authenticated, but GitHub does not provide shell access."

Conclusion

As technology evolves, Git remains the undisputed backbone of version control, while GitHub continues to lead the way in collaborative software innovation.

Understanding the distinction between these two is vital for any developer: Git is the engine that tracks and manages your code changes, while GitHub is the hub that simplifies collaboration, hosting, and project management.

I hope this breakdown provides a clear starting point for your journey. I’d love to hear your thoughts—feel free to drop a comment below!

>Let's learn together.

Top comments (1)

Collapse
 
jacquigee profile image
Jacquiline Gitau

Thanks for the pro tip on Git and Github :)