codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
📦

Git & GitHub

22 / 63 topics
20Introduction to GitHub21Creating and Managing GitHub Accounts22Creating and Managing Repositories on GitHub23Forking Repositories24Using Pull Requests25Managing Issues on GitHub26Using Milestones and Labels27Creating and Managing Wikis28Publishing with GitHub Pages
Tutorials/Git & GitHub/Creating and Managing Repositories on GitHub
📦Git & GitHub

Creating and Managing Repositories on GitHub

Updated 2026-04-20
4 min read

Creating and Managing Repositories on GitHub

Introduction

GitHub is a web-based platform for version control and collaboration that uses Git as its underlying technology. In this tutorial, we will explore how to create and manage repositories on GitHub, which are essential for organizing your codebase and collaborating with others.

Prerequisites

Before you begin, ensure you have the following:

  • A GitHub account. If you don't have one, sign up at GitHub.
  • Basic understanding of Git and version control concepts.
  • Git installed on your local machine. You can download it from Git's official website.

Creating a New Repository

Step 1: Create a Repository on GitHub

  1. Log in to GitHub: Go to GitHub and log in with your account.

  2. Navigate to Repositories: Click on the "+" icon in the upper right corner and select "New repository".

  3. Configure Repository Settings:

    • Repository Name: Enter a name for your repository.
    • Description: Optionally, add a description of your project.
    • Visibility: Choose between public (visible to everyone) or private (only visible to you and collaborators).
    • Initialize with README: Check this box if you want to create an initial README.md file.
    • Add .gitignore: Select a .gitignore template if needed. This helps in ignoring certain files that are not necessary for version control, such as logs or build artifacts.
    • Choose License: Optionally, select a license for your project.
  4. Create Repository: Click the "Create repository" button to finalize the creation.

Step 2: Clone the Repository Locally

To work on your repository locally, you need to clone it using Git:

git clone https://github.com/your-username/repository-name.git
cd repository-name

Managing a Repository

Adding Files and Committing Changes

  1. Add Files: Add new files or modify existing ones in your local repository.
  2. Stage Changes:
    git add .
    
  3. Commit Changes:
    git commit -m "Your commit message"
    

Pushing Changes to GitHub

After committing changes locally, you need to push them to the remote repository on GitHub:

git push origin main

Replace main with your branch name if it's different.

Branch Management

Branches allow you to work on separate lines of development without affecting the main codebase.

  1. Create a New Branch:
    git checkout -b new-branch-name
    
  2. Switch Between Branches:
    git checkout branch-name
    
  3. Delete a Local Branch:
    git branch -d branch-name
    

Pulling Changes from GitHub

To update your local repository with changes made by others, use:

git pull origin main

Collaborating with Others

Adding Collaborators

  1. Navigate to Repository: Go to your repository on GitHub.
  2. Settings: Click on the "Settings" tab.
  3. Manage Access: Under "Manage access", click "Invite a collaborator".
  4. Enter Username: Type the username of the person you want to invite and send an invitation.

Pull Requests

Pull requests are used to propose changes from one branch to another, usually from a feature branch to the main branch.

  1. Create a Branch: Create and switch to a new branch for your changes.
  2. Commit Changes: Commit your changes as usual.
  3. Push Branch:
    git push origin new-branch-name
    
  4. Create Pull Request: Go to your repository on GitHub, click "New pull request", select the base and compare branches, write a description, and submit.

Reviewing Pull Requests

  1. Navigate to Pull Requests: Click on "Pull requests" in your repository.
  2. Review Changes: Check the changes proposed by the contributor.
  3. Comment and Request Changes: Use the comment feature to provide feedback or request changes.
  4. Merge Pull Request: Once satisfied, merge the pull request.

Best Practices

  • Regularly Commit Changes: Make small, frequent commits with clear messages.
  • Use Descriptive Branch Names: This helps in understanding the purpose of each branch.
  • Keep Your Repository Clean: Regularly clean up unnecessary files and branches.
  • Frequent Pulls: Pull changes from the remote repository frequently to avoid merge conflicts.

Conclusion

Creating and managing repositories on GitHub is a fundamental skill for any developer. By following this guide, you should be able to effectively create, manage, and collaborate on repositories using Git and GitHub. Remember to apply best practices to maintain a clean and organized codebase.


PreviousCreating and Managing GitHub AccountsNext Forking Repositories

Recommended Gear

Creating and Managing GitHub AccountsForking Repositories