Skip to content

CodeSignal/GitCourse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Quickstart for Creating a GitHub Repository

This guide will help you quickly create and set up a repository on GitHub and connect it to a local repository on your computer.


Step 1: Create a New Repository on GitHub

  1. Go to GitHub:

  2. Start a New Repository:

  3. Name Your Repository:

    • Enter a name for your repository (e.g., my-new-repo).
    • Optionally, add a description.
  4. Choose Visibility:

    • Select Public if you want the repository to be visible to everyone, or Private to restrict access to yourself and collaborators.
  5. Skip Initializing Options (Optional):

    • For this example, we’ll skip adding a README file, .gitignore, or license. (You can add these files later from your local machine or GitHub.)
  6. Create Repository:

    • Click Create repository to generate the repository on GitHub. You’ll be taken to the new repository’s page.

Step 2: Set Up the Local Repository

If You’re Starting from Scratch

  1. Open Your Terminal:

    • On your computer, open a terminal (or command prompt).
  2. Create a New Folder (if you don’t have one already):

    mkdir my-new-repo
    cd my-new-repo
  3. Initialize Git:

    • Set up Git for version control in your folder by running:
    git init
  4. Add a README (Optional):

    • Create a README file to describe your project:
    echo "# My New Repo" > README.md
  5. Stage and Commit Files:

    • Stage and commit your files:
    git add .
    git commit -m "Initial commit"

Step 3: Connect Your Local Repository to GitHub

  1. Copy the Repository URL:

    • On your GitHub repository page, you’ll see a Quick setup section with the repository URL (it looks like https://github.com/username/my-new-repo.git). Copy this URL.
  2. Add the Remote Origin:

    • In your terminal, link your local repository to GitHub:
    git remote add origin <your-repository-url>

    Replace <your-repository-url> with the URL you copied.

  3. Push Your Local Repository to GitHub:

    • To upload your code to GitHub for the first time, use:
    git push -u origin main

Step 4: Verify and Manage Your Repository

  • Check GitHub:

    • Go back to your repository page on GitHub and refresh to see your files.
  • Future Changes:

    • After making changes to your files locally, use the following commands to push updates to GitHub:
      git add .
      git commit -m "Describe your changes"
      git push

You’ve now successfully created a GitHub repository and linked it to your local project! For more details, refer to GitHub’s official documentation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published