A beginner's guide to getting started with GitHub
New to GitHub? Learn basic concepts like repositories, branches, and pull requests to start your open-source journey.
Do you ever find yourself wondering, "What is GitHub?" or wishing you had the opportunity to learn the basics of Git? If so, you've come to the right place! I know you probably have a ton of questions, and I’m genuinely excited to help you navigate through them all.
Today, I’m going to dive into the basics of getting started with GitHub.
I’ll walk you through everything from setting up your GitHub account to understanding how to contribute using GitHub flow, merging your first pull request, and finally discussing some tips with common pitfalls to avoid.
What is GitHub and why is it important?
Well, GitHub is a cloud-based platform where you can store, share, and work together with others to write code. Under the hood, it is powered by Git, a distributed version control system designed to track changes in our code.
Git tracks different versions of your project’s progress as you develop, while GitHub handles hosting and distribution on its servers. As a result, you can reliably access code changes from any computer with internet access.
In a traditional development environment without source control systems, collaboration can be cumbersome.
For instance, before GitHub emerged, developers often relied on mailing lists and patch submissions. They would create patches (diff between versions) and send them via email for review.
Maintainers would then manually apply these patches to the codebase. This process mostly led to confusion at times, as tracking feedback was disjointed.
GitHub revolutionized this process by integrating community features directly into the development workflow. Issues, pull requests, discussions, and CI/CD are all part of the same platform.
➡️ This means that when a developer submits a code change proposal, their colleagues can review and make code suggestions, tag open bug issues, and run automated workflow against those changes — all in one place.
Without tools like GitHub and Git, open-source development wouldn’t be what it is today.
Speaking of open-source, some open source llms can't be missed even if you are a beginner, same goes for llm trends if you want to be a top-notch dev.
Set up your GitHub account and configure Git
To get started with GitHub, you'll need to create an account. Head over to their sign-up page and follow the prompts to create a personal account.
Next, you'll want to make sure Git is installed and configured with your GitHub info. While Git comes pre-installed on some macOS and Linux-based systems, Windows does not include Git by default, so you'll need to install it separately.
You can easily verify if Git is installed by executing the following command in your terminal:
If you see a message along the lines `command not found`, that means you don’t have it installed. No worries — you can download Git for your operating system here.
Once Git is installed, it’s time to set up your name
and email
in your global gitconfig
.
In your terminal, run the following commands, substituting the placeholders with your own details:
To confirm that your Git username and email were set correctly, run these commands:
You should see the credentials you entered earlier. For example, on my computer, this is what I get:
Next, to push changes between your local machine and GitHub, you need to authenticate. If you're cloning a private repository, you'll also need to authenticate.
Public repositories, on the other hand, can be cloned without being authenticated.
There are two main protocols for authentication: https
and ssh
. While HTTPS authentication can work fine, using SSH is often the preferred secure method, especially with GitHub disabling using your account password to authenticate.
Besides, SSH is way more convenient as it allows you to push changes without needing to enter your username and token every time.
If you must authenticate with https
, you'll have to create a Personal Access Token with specific permissions.
To get started with SSH, you'll first need to generate an SSH key if you haven’t done so already. You can create one by running the following command in your terminal:
Replace "youremail@example.com"
with the email associated with your GitHub account.
Once you’ve generated the key, add it to your SSH agent. Your SSH agent holds your private SSH keys in memory and provides them to SSH clients when requested:
Next, you’ll need to add the SSH key to your GitHub account. You can easily do this using the GitHub CLI, or from your GitHub profile settings if you prefer a GUI. You don't have to choose, I’ll show you both methods:
If you don’t have the GitHub CLI installed yet, it’s available via Homebrew, Conda, Webi, and many other package managers for all operating systems.
Once you have the GitHub CLI installed, log in using the following command:
You should receive a prompt asking if you want to upload your SSH public key. You’ll also be prompted to add a title to help you identify which machine this key is for.
Select the Ed25519 key
you generated and hit enter:
After that, you'll be redirected to your browser to complete the login process:

After finishing that, head back to your terminal. You should see a successful login message that looks something like this:
To verify that everything was successful, you can use the command gh auth status
. You should see information similar to this, with ssh
as your git operations protocol.
That's it, you've set up your local machine to interact with GitHub using SSH.
If you prefer a GUI, you can add SSH key by navigating to your profile under SSH and GPG Keys. In this page, you’ll find a button labeled "New SSH Key."
Clicking it will prompt you for the same details you entered when you used the CLI.
Additionally, just below the button, you should be able to view a list of SSH keys associated with your account, labeled with the title you assigned to it.

What are repositories, branches, commits, and pull requests?
Repository: A repository (or repo for short), is a space where project files live, allowing for version control and collaboration. You can think of it as a project folder that tracks changes, stores history, and lets multiple people work together.
Branch: A branch is a separate version of your code within a repository. It allows you to work on different features or bug fixes in isolation without affecting the default codebase (often referred to as
main
). Once you’re satisfied with the changes on a branch, you can merge them back into the main branch.Commit: A commit is a snapshot of your entire repository at a specific point in time compressed into a SHA. It records changes you've made to the code in your branch, along with a message describing those changes. Each commit contributes to the project's history in the form of a linked list.
Pull Request: A pull request is a way to propose changes you've made on a branch to be merged back into the main branch. It allows collaborators to compare and discuss the differences introduced before the changes are integrated.
Understanding the GitHub workflow
If you've ever worked on a project with dozens of developers, you know that without a structured way to contribute changes, things become a hot mess real quick—sadly, I know this from experience.
Over the years, the combination of common Git practices with GitHub's native features has led to a widely accepted workflow coined by GitHub as "GitHub flow."
If you’re working in a team, there’s a good chance you’re already utilizing some aspect of this workflow.

So, what is GitHub flow?
It is a branch-based workflow that involves creating a new branch for each feature or bug fix, making changes, opening a pull request for review, and merging those changes back into the main branch once approved.
In this section, I’ll walk you through the GitHub flow by creating a simple JavaScript project.
Create a repository
Log into GitHub and click the green "New" button on your profile dashboard. On the next page, enter a name for your repository, choose the owner (usually you), and select whether to make it public or private.
Upon submitting, you should have a new repository.
Create a branch
The first step in adding code to your repository is to create a new branch. Branching allows you to have different versions of your repository at the same time, which is essential for protecting your main branch.
This is because the main branch serves as the stable version of your project and is often deployed to production or distributed.
By branching off from the main branch, you gain the ability to make changes without risking the stability of the main codebase. Once your changes are finished and tested, you can confidently merge the branch back into the main branch.
To create a new branch, click the dropdown menu that says `main` to view all branches. There, you’ll find a button labeled "New branch."
Click it, enter a name for your new branch, and then click "Create new branch."
Clone repository
Cloning a repository creates a copy of your repository locally on your machine, allowing you to make changes and test them without affecting the version hosted on GitHub.
To clone your repository, navigate to your repository's main page on GitHub. Look for the green "Code" button and click on it. Copy the ssh URL displayed, then navigate to the directory on your machine where you want to store the cloned repository. Run the following command:
Replace <https://github.com/your-username/repo-name.git>
with the actual URL you copied.
Make and commit changes
You can easily make and save changes to the files in your repository, which are referred to as commits on GitHub, just like in Git.
Before making any changes, ensure you're on the correct branch by switching to it:
Once you’re on the right branch, using your preferred code editor, create the code you’d like to upload. Once you're satisfied with your changes, head back to your terminal.
Running git status
will show you which files have been changed.
To commit them, you first need to add these files to the staging area using:
This command includes all modified files. After that, commit your changes with a clear message by running:
Make sure to replace "My commit message" with a brief description of your changes.
Push changes and open a pull request
Now that your changes are committed locally, it’s time to push them to your remote repository on GitHub. Use the following command:
Once the push is complete, you can create a pull request directly from the command line using the following GitHub CLI command:
This initiates the review process, allowing you or your team members to check your changes and provide feedback before merging them into the `main`
branch.
Merge your pull request
Once your pull request has been reviewed, it’s time to merge it into the main branch.
Simply navigate to your pull request page. You’ll see a big green button labeled “Merge pull request.”

Click it, and GitHub will prompt you to confirm the merge.

After confirming, your changes will be integrated into the main branch.
Conclusion
I want to applaud you for making it this far.
You’ve successfully learned the essentials of GitHub, from creating a repository all the way to merging your first pull request using the GitHub flow.
These foundational skills open up endless opportunities for collaboration, especially in the realm of open source.
As you continue your journey with GitHub, keep in mind that tools like Pieces can be your trusted ally.
Many beginners and students have found Pieces to be an essential companion in their learning process.
Also, myself including, found 2-day GitHub Bootcamp in a Box quite useful.
