Skip to main content
In this lesson we’ll walk through creating a GitHub repository in the web UI, adding files, creating a branch, cloning the repo locally, making changes on a feature branch, and pushing those changes back to GitHub. Each image below corresponds to a step in the workflow and is shown in the original sequence so you can follow along visually.

1. Create a new repository on GitHub

Open GitHub in your browser and create a new repository. Choose a clear repository name (for example, block-buster) and add an optional description describing what the project does. For discoverability choose Public if you want anyone to view the repository. Initialize the repository with a README.md (so visitors immediately see project context), add a .gitignore (to exclude editor or OS-specific files, e.g., VS Code artifacts), and optionally choose a license.
The image shows a GitHub dashboard with repositories listed on the left and a section promoting a GitHub for Beginners YouTube playlist on the right. There are various options for creating issues, writing code, and managing repositories at the top.
When filling in repository details, the web UI guides you through the name, description, visibility, and initialization options.
This image shows a GitHub interface for creating a new repository, with fields for the repository name, description, and visibility settings. The visibility option is highlighted, with a choice between "Public" and "Private."

2. Add project files via the web UI (optional)

You can upload your initial project files directly from the GitHub UI: use Add files → Upload files. Common files for a simple web project include index.html, script.js, and style.css. Provide a short commit message (for example, init) and commit directly to main or create a new branch from the UI.
The image shows a GitHub interface for uploading files to a repository, with fields for file selection and commit messages, and options for committing to a branch or creating a new branch.

3. Create a feature branch in the GitHub UI

Working on a branch keeps main stable. From the repository page you can create a feature branch (for example, feature-1) and continue development there.
The image shows a GitHub repository page for a project named "block-buster" with a menu open to create a new branch named "feature-1." It features information about the project, including its description and commit history.

4. Clone the repository locally

On your machine, clone the repository to work locally. Copy the HTTPS clone URL from the GitHub repository page and run the commands below. This example creates a ~/github-repos directory and clones block-buster into it:
Example output after cloning:
If a remote branch (feature-1) exists and you want it locally, create a local tracking branch.

5. Make changes locally and push to the feature branch

Open the project in your editor (for example, Visual Studio Code) and make changes to README.md or add new files/folders. The image below shows a README open while on a feature branch in VS Code.
The image shows a Visual Studio Code workspace with a README.md file open, detailing a "Block Buster - Game" project using HTML, CSS, and JavaScript. There's also a terminal at the bottom displaying the current Git branch and repository information.
When your edits are ready, stage, commit, and push them to the remote feature branch. You can use the editor’s GUI or run these commands in the terminal:
The image shows a Visual Studio Code workspace with a project open, displaying a README.md file outlining features and technical details. A terminal at the bottom is ready for input, set on a feature branch.

Common Git troubleshooting (authentication / permissions)

If a push fails with a permission issue, you may see:
A few diagnostic steps:
  1. Check the currently configured remotes:
  2. If credentials are cached and causing issues, make Git prompt for credentials by unsetting the credential helper (this may vary by OS):
    Note: macOS Keychain, Windows Credential Manager, or other external helpers may store credentials outside Git; remove them via your OS credential manager if needed.
  3. Optionally embed your username in the remote URL so Git prompts for a password for that user:
Important: GitHub no longer accepts account passwords for Git operations over HTTPS. Use a personal access token (PAT) instead.
When pushing over HTTPS, provide a personal access token (PAT) as the password. Alternatively, configure an SSH key and use the SSH clone URL to avoid HTTPS-based token prompts.

6. Create and use a Personal Access Token (PAT)

To create a PAT: go to GitHub Settings → Developer settings → Personal access tokens (classic) or choose the newer fine‑grained tokens depending on your needs. For pushes you typically need repo scope (or repository-specific scopes for fine‑grained tokens). Set an expiration, generate the token, and copy it immediately — GitHub shows it only once.
The image shows a GitHub interface for creating a new personal access token (classic) with options for setting its expiration and permissions. Options for expiration include specific days or no expiration.
When prompted for credentials during git push:
  • Enter your GitHub username.
  • Paste the PAT when asked for the password.
A successful push looks like:
If you need to view, edit, or revoke tokens later, go to Developer settings → Personal access tokens in your GitHub account.
The image shows the GitHub Developer Settings page for personal access tokens, with an example token displayed for copying or deletion.
Never commit your personal access tokens, SSH private keys, or other secrets into a repository. Use environment variables, secret managers, or GitHub Secrets for CI workflows instead.

7. Confirm changes on GitHub

Back on GitHub you can browse the feature-1 branch to confirm your pushed changes, including README updates, images, code blocks, and project structure.
The image shows a GitHub repository page for a project called "Block Buster - Game." It includes a README section with instructions for downloading and playing a brick breaker game built with HTML5, CSS, and JavaScript.
The image shows a GitHub README section that lists features of a game, including core gameplay mechanics, power-ups, and technical features like responsive design and data persistence.

Quick reference — common commands

Summary

This workflow demonstrates how to:
  • Create a repository on GitHub (including README.md and .gitignore).
  • Upload files via the web UI or work locally after cloning.
  • Create and switch to feature branches.
  • Clone repositories and manage branches locally.
  • Resolve common authentication issues by using a Personal Access Token (PAT) for HTTPS pushes, or by using SSH keys.
This article focuses on the basic operations described above. It does not cover pull requests, merging feature-1 into main, or repository access controls in depth. To invite collaborators (for code review or contributions) go to the repository Settings → Manage access and add reviewers or contributors (for example, Siddharth and Alice McBury). Further reading:

Watch Video