How to create repository in github

How to create repository in github

Creating a GitHub Repository

Create a GitHub Account:

  • Go to GitHub and sign up for an account using your desired username and password.

Sign In to Your Account:

  • Once your account is created, sign in using your username and password.

Create a New Repository:

  • After signing in, click on the "Repositories" tab on the top navigation bar.
  • Click the green "New" button on the right side of the page.

Configure Your Repository:

  • Repository Name: Enter a name for your repository. If using multiple words, use hyphens (-) or underscores (_) to separate them (e.g., demo-website).
  • Description: Add a brief description of your project (e.g., "Developing a website using HTML, CSS, JavaScript").
  • Repository Visibility: Choose "Public" if you want your repository to be visible to everyone, or "Private" if you want to restrict access to selective people like your team.
  • Initialize with a README: Check the box to add a README file. This is a text file where you can write a detailed description of your project.
     

Create the Repository:

  • Click the green "Create repository" button.

Cloning Your Repository

Clone the Repository:

  • On your repository's page, click the "Code" button.
  • Copy the repository URL provided.

Clone Using Git Bash:

  • Go to your desktop, right-click, and select "Git Bash Here" to open the terminal.
  • In the terminal, type git clone and paste the copied URL. Press Enter.
  • This will create a folder named after your repository (e.g., demo-website) on your desktop.

Setting Up Your Project

Open the Project in VS Code:

  • Navigate to the created folder (e.g., demo-website) and open it in Visual Studio Code.

Create and Edit Files:

  • Create an index.html file and write your HTML code.

Using Git Commands

Open Terminal in VS Code:

  • Open the terminal in VS Code by navigating to View > Terminal or using the shortcut (Ctrl + `).

Run Git Commands:

Check the Status:       

          git status

Stage Changes:

         git add . 

Configure Git Username:

           git config --global user.name "YourUsername"


Configure Git Email:

              git config --global user.email "your.email@example.com"

Commit Changes:

             git commit -m "Add initial project files"


Push Changes to GitHub:

              git push origin main


Save Credentials (Optional):

  • If you want to save your credentials, you can set up a credential helper:

              git config --global credential.helper store

Summary

  1. Create a GitHub account and sign in.
  2. Create a new repository with a proper name, description, and visibility settings.
  3. Clone the repository to your local machine using Git Bash.
  4. Open the cloned repository in VS Code and create necessary project files.
  5. Use Git commands to manage and push your changes to GitHub.

By following these steps, you'll have a new GitHub repository, clone it to your local machine, set up your project in VS Code, and manage it using Git commands.
 

©Copyright ©All rights reserved

This site by Heuristic Academy