Visit Sponsor

Written by 1:16 pm Blog

Create a New Repository in GitHub – Step‑By‑Step Guide

Creating a repository is the foundation for version control and collaborative development on GitHub. A repository (repo) stores your project’s code, history, issues, pull requests, and documentation. Whether you’re launching a new project, contributing to OSS, or managing work in teams, knowing how to create and configure a GitHub repository is essential.

This updated guide on javatechig.com provides a complete, practical walkthrough to create a new repository — from setup to first commit — with recommended settings for real‑world workflows.

What Is a GitHub Repository?

A GitHub repository is a storage space for your project. It holds:

  • Source code
  • Revision history
  • Issues and project boards
  • Pull requests and collaboration tools

Repositories can be public (visible to everyone) or private (restricted access).

Prerequisites

Before creating a repository:

  • Have a GitHub account (free or paid)
  • Install Git CLI locally:
git --version
  • Configure your Git identity locally:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

This ensures commits are correctly attributed.

Step 1 — Navigate to New Repository Page

  1. Log in to github.com
  2. Click the “+” (plus) icon in the top‑right corner
  3. Select New repository

You’ll reach the “Create a new repository” form.

Step 2 — Repository Details

Repository Name

Choose a clear, descriptive name, e.g., android-image‑uploader.

Description (Optional)

Add a brief explanation:
“Android app project to upload images to server using multipart requests.”

Descriptions improve readability and search discoverability.

Visibility

Choose one of:

  • Public — visible to everyone
  • Private — only invited collaborators

Public repos help open‑source discovery; private repos are ideal for internal work.

Step 3 — Initialize Repository

Enable these recommended options:

✔ Initialize with README

Creates a README.md file — your project’s landing page.

✔ Add .gitignore

Select from templates (e.g., Java, Android, Node) to ignore build files.

✔ Add License

Choose a license like MIT or Apache‑2.0 if open‑sourcing the repo.

Then click Create repository.

Step 4 – Clone Repository Locally

After creation, GitHub shows clone URLs:

HTTPS

git clone https://github.com/yourusername/repo-name.git

SSH (preferred for developers)

git clone git@github.com:yourusername/repo-name.git

SSH requires a configured SSH key for authentication.

Step 5 – Add Code and Push Changes

Navigate to Project

cd repo-name

Add Files

git add .

Commit with Message

git commit -m "Initial commit"

Push to GitHub

git push origin main

If your branch is master, replace main accordingly.

Post‑Creation Best Practices

Write a Good README

Include:

  • Project title
  • Description
  • Features
  • Setup instructions
  • Usage examples

Good READMEs boost onboarding and usability.

Set Branch Protection Rules

In Settings → Branches:

  • Require pull request reviews
  • Enforce status checks
  • Sign commits if needed

These safeguards ensure quality and consistency.

Add ISSUE TEMPLATES

Automate issue tracking with templates under:

.github/ISSUE_TEMPLATE/

This improves team workflows.

Use Labels and Projects

Organize work using:

  • Labels (bug, enhancement)
  • GitHub Projects (Kanban)

These help prioritize tasks and track progress.

Collaborator Access

To invite teammates:

  1. Go to Settings → Collaborators & teams
  2. Add GitHub username
  3. Grant read/write/admin roles

This enables controlled collaboration.

Advanced Tips

Use GitHub CLI

Install CLI:

gh --version

Create a repo from terminal:

gh repo create

This simplifies workflows for power users.

Continuous Integration

Integrate CI/CD with GitHub Actions:

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu‑latest
    steps:
      ‑ uses: actions/checkout@v3
      ‑ name: Build
        run: mvn clean compile

This automates testing and builds.

Summary

Creating a repository on GitHub is a foundational skill for developers. Following this modern, practical workflow — naming, visibility, initialization, cloning, and best practices — sets up your project for successful development and collaboration.

If you want, I can also add step‑by‑step screenshots or visual UI navigation tips to enhance engagement and ranking. Let me know!

Visited 6 times, 1 visit(s) today
Close