Naa College Blog / Student Tools & Resources

GitHub Basics for Beginners: A Complete Step-by-Step Guide for Students

GitHub is the place where developers store, share and collaborate on code. This beginner guide explains Git and GitHub in simple language with practical commands and examples.

12 min read ยท By naacollege.in Editorial Team

Introduction

If you want a career in software, data science, AI or even cybersecurity, you will hear about GitHub very soon. Recruiters check GitHub profiles, open source projects live there, and almost every tech team uses it to manage code.

This guide explains everything a beginner needs: what Git and GitHub are, how to install and set up, the most useful commands, branching, pull requests and tips to build a profile that impresses.

Git vs GitHub: What Is the Difference?

Git is a version control system. It runs on your computer and tracks every change you make to your files, so you can go back to an older version, compare changes and work safely.

GitHub is a website and platform that hosts Git repositories online. It adds collaboration features such as pull requests, issues, project boards and automation. Other similar platforms are GitLab and Bitbucket, but GitHub is the most popular.

Takeaway: Git is the tool. GitHub is the online home for your Git projects.

Why Should Students Learn GitHub?

  • Keeps a backup of your projects online
  • Shows your skills through a public portfolio
  • Lets you collaborate with classmates without overwriting each other's work
  • Is required knowledge for internships and developer jobs
  • Gives you a way to contribute to open source projects
  • Helps you track mistakes and undo them safely

Key Terms You Must Know

TermMeaning
Repository (repo)A project folder tracked by Git
CommitA saved snapshot of your changes with a message
BranchA separate line of work, so you can try things safely
MergeCombining changes from one branch into another
CloneCopying a remote repository to your computer
ForkYour own copy of someone else's repository on GitHub
PushSending your local commits to GitHub
PullGetting the latest changes from GitHub
Pull request (PR)A request to merge your changes into another branch or repo
IssueA task, bug or idea logged in a repository

Step 1: Create a GitHub Account

Go to github.com and sign up with your email. Choose a professional username because it becomes part of your profile link. Something like your name works better than a random nickname. Add a clear profile photo and a short bio.

Enable two-factor authentication in your security settings to protect your account.

Step 2: Install Git

Download Git from the official Git website and install it. On Windows it comes with Git Bash. On macOS and Linux you can install it using the package manager. After installing, open a terminal and check the version.

git --version

Step 3: Configure Git

Tell Git who you are. This information is attached to every commit you make. Use the same email as your GitHub account.

git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global init.defaultBranch main

Step 4: Create Your First Repository

You can start locally and then connect to GitHub. Create a folder, initialise Git, add a file, and make your first commit.

mkdir my-first-project
cd my-first-project
git init
echo "# My First Project" > README.md
git status
git add README.md
git commit -m "Add README"

Step 5: Connect to GitHub and Push

On GitHub, click New repository, give it a name and create it without adding files. GitHub will show you a repository URL. Link your local project to it and push your code.

git remote add origin https://github.com/your-username/my-first-project.git
git branch -M main
git push -u origin main
Note: GitHub no longer accepts account passwords for Git operations over HTTPS. Use a personal access token, GitHub CLI login, the GitHub Desktop app, or set up SSH keys.

The Everyday Git Workflow

Most of your daily work follows a simple loop: check status, stage changes, commit and push.

git status
git add .
git commit -m "Describe what you changed"
git push

Write commit messages that explain what changed and why, for example Fix login button alignment. Avoid messages like final or changes2.

Most Useful Git Commands

CommandWhat it does
git statusShows changed and staged files
git add fileStages a file for the next commit
git commit -m "msg"Saves staged changes
git log --onelineShows a short commit history
git diffShows what changed in your files
git clone urlCopies a repo to your computer
git pullDownloads and merges the latest changes
git pushUploads your commits
git branchLists branches
git switch -c nameCreates and moves to a new branch
git merge nameMerges a branch into the current one
git restore fileDiscards unstaged changes in a file

Branches: Work Safely Without Breaking Your Project

A branch lets you build a new feature without touching your stable code. The main branch usually holds the working version. You create a new branch for each feature or fix, then merge it when it is ready.

git switch -c add-login-page
# make changes
git add .
git commit -m "Add login page"
git push -u origin add-login-page

Pull Requests: How Teams Collaborate

After pushing a branch, open GitHub and click Compare and pull request. Write a clear title and description, then submit. Teammates can review your code, leave comments and approve it. When everyone is happy, the PR is merged into the main branch.

Pull requests are also how you contribute to open source: fork the project, create a branch, make your change, push it, and open a pull request to the original repository.

Handling Merge Conflicts

A merge conflict happens when two people change the same lines of a file. Git cannot decide which version to keep, so it asks you. Open the file, look for the conflict markers, choose the correct content, remove the markers, then stage and commit the result.

Do not panic. Conflicts are normal in team projects. Pull often and keep branches small to reduce them.

Important Files in a Repository

  • README.md: explains what the project does, how to install it and how to use it
  • .gitignore: lists files Git should not track, such as passwords, environment files and build folders
  • LICENSE: tells others how they can use your code
  • requirements.txt or package.json: lists dependencies
Note: Never upload API keys, passwords or private data to a public repository. If you do by mistake, revoke the key immediately.

Other Useful GitHub Features

  • Issues: track bugs and tasks
  • Projects: kanban-style boards for planning
  • GitHub Pages: host a free static website or portfolio from a repository
  • GitHub Actions: automate tests and deployments
  • Codespaces: write code in a cloud development environment
  • Discussions and stars: community interaction and bookmarking projects
  • Copilot: AI coding assistant available through GitHub with its own plans

How to Build a Strong GitHub Profile as a Student

  • Create a profile README that introduces you, your skills and your best projects
  • Pin your best six repositories
  • Add clear README files with screenshots and setup steps to every project
  • Commit regularly instead of uploading everything on one day
  • Build real projects: a portfolio site, a to-do app, a data analysis notebook, a small game
  • Contribute to beginner-friendly open source issues labelled good first issue
  • Keep repository names meaningful and your code tidy

Common Beginner Mistakes

  • Committing sensitive files such as passwords and keys
  • Writing meaningless commit messages
  • Working directly on main in team projects
  • Forgetting to pull before pushing
  • Uploading huge files or entire node_modules folders
  • Using GitHub only as storage without documentation

30-Day Practice Plan

WeekGoal
Week 1Create account, install Git, make your first repo, practise add, commit and push
Week 2Learn branches, merging and resolving a simple conflict
Week 3Fork a practice repo, open your first pull request, write good READMEs
Week 4Publish a portfolio with GitHub Pages and make a profile README

Conclusion

GitHub may feel confusing on day one, but a few commands and habits take you a long way. Start with one small project, commit regularly, write clear READMEs and slowly explore branches and pull requests. In a few weeks you will have a profile that proves your skills.

Frequently Asked Questions

Is GitHub free?

Yes. GitHub offers free accounts with public and private repositories. Paid plans add extra features for teams and organisations.

Do I need to know coding before learning Git?

Basic coding helps, but you can learn Git using simple text files. It works with any kind of file.

Is Git the same as GitHub?

No. Git is the version control tool. GitHub is the online platform that hosts Git repositories.

Can I use GitHub without the command line?

Yes. GitHub Desktop and the web interface let you do many tasks visually, though learning basic commands is very valuable.

Does GitHub help in getting a job?

A well-maintained profile with real projects shows practical skills and consistency, which many recruiters appreciate.

Disclaimer: Interface layouts and authentication methods on GitHub can change. Check the official GitHub Docs for the latest instructions.

Educational information only. Verify time-sensitive details with the relevant official authority or product documentation.