Getting Started with GitHub: New User Insights

Jun 8, 2024

With over 100 million repositories and vibrant community of developers, GitHub is more than just a platform - its a gateway to innovation and creativity. So buckle up as we dive into setting up your account, creating repositories, mastering basic commands. The GitHub adventure awaits - let's learn together...

What is GitHub?

GitHub is a web-based platform that leverages Git, an open-source version control system, enabling multiple contributors to collaborate on projects simultaneously by making and managing separate changes efficiently.

Why should you use GitHub?

  1. Easy Contribution: Git simplifies contributing to open-source projects by allowing users to fork, modify, and submit pull requests easily.

  2. Comprehensive Documentation: GitHub's extensive help section and guides facilitate thorough documentation and learning.

  3. Showcase Work: Developers can use GitHub to display their work, attracting potential recruiters and collaborators.

  4. Markdown Support: GitHub uses Markdown for formatted documents, streamlining content creation.

  5. Wide Exposure: GitHub serves as a vast repository, providing significant exposure for projects within a large coding community.

  6. Version Control: Git efficiently tracks changes across versions, making collaboration and revision management seamless.

  7. Integration Options: GitHub integrates with various platforms and services, supporting syntax highlighting for over 200 programming language

How to Set up your GitHub account

  1. Sign up for GitHub

This is where the journey starts. Get your laptop, open any browser, and navigate to GitHub. Click here.

To sign up, you will need to input your email address, name, username, and password, and verify your account. It's simple! You now have a GitHub account.

  1. Install Git

For Macs and Linux-based systems, Git comes preinstalled. However, you can always check if it is installed by typing git version in your terminal or command prompt. For example, I have Git version 2.42.0 installed on my machine, as shown in the image below.

If you don't have Git installed on your machine, you can download it from here and install it. After installation, you can verify the installation by typing git version in the terminal or command prompt.

  1. Connect your GitHub account to your Git account.

After downloading Git and creating a GitHub account, we now need to connect the two.

To set your Git username, use:

git config --global user.name "lucy-kevin"

Replace lucy-kevin with your username.

You can now check to confirm by using:

git config --global

The output will display your username.

To set your email, type:

git config --global user.email "youremail@gmail.com"

To check it, input:

git config --global

Once we have connected our GitHub account with the Git account, let's proceed to create our first repository on GitHub.

How to Create Your First Repository

Open GitHub in your preferred web browser, then navigate to the top right corner and click on the dropdown menu.

Click on "New repository," and you will be directed to the page below.

In the Repository name textbox, enter your repository's name. Optionally, add a description. Choose whether your repository will be public or private. Check the Add a README file box. Scroll down and click Create Repository to proceed to the next page.

How to Push your code to GitHub

After creating the repository, you can now connect VS Code to GitHub. Since VS Code has built-in GitHub integration, no additional extensions are needed. Learn how to connect VS Code to GitHub by following this guide.

From the page after creating the repository, copy the link to your repository. Then, open VS Code and navigate to the left sidebar. Click on Clone repository, which will prompt the VS Code search bar. Paste the link you copied from GitHub into the search bar. Follow the given prompts and save the folder in your local machine.

You can also click on Clone from GitHub and select the repository you want to work with.

Once you've written your code, you can proceed to commit your changes. In the terminal, type git commit -m "I have added Dart code" or use the provided image above as a reference to write a commit message and commit your changes.

To push your code to GitHub, use the command git push origin <branch-name> in the terminal, replacing <branch-name> with the name of your branch. This action will upload your changes to your GitHub repository.

Basic GitHub Commands you should know

  • git init: Initialize a new Git repository in the current directory.

  • git clone <repository-url>: Clone a repository from a URL to your local machine.

  • git add <file>: Add a file to the staging area for the next commit.

  • git commit -m "commit message": Commit staged changes with a descriptive message.

  • git push: Upload local repository content to a remote repository.

  • git pull: Fetch changes from the remote repository and merge them into the current branch.

  • git branch: List all local branches in the current repository.

  • git checkout <branch-name>: Switch to a different branch.

  • git merge <branch-name>: Merge changes from one branch into the current branch.

  • git status: Display the current state of the repository, including changes to tracked files

Clearly, the beginner's guide to GitHub has revealed its role as a gateway to collaboration, innovation, and boundless opportunities. Through grasping core concepts and mastering essential commands, I've embarked on a journey toward proficiency in GitHub usage.

Looking forward to sharing more insights and discoveries from my journey with GitHub as I continue participating in All in Africa program. Remember mastering GitHub is an ongoing process and there's always something to learn. Happy coding!

Sign Up To My Newsletter

Get notified when a new article is posted.

Sign Up To My Newsletter

Get notified when a new article is posted.

Sign Up To My Newsletter

Get notified when a new article is posted.