Skip to main content

Command Palette

Search for a command to run...

Remote Repos, GitHub Setup, Git PUSH, PULL, Clone

Published
•3 min read•View as Markdown
Remote Repos, GitHub Setup, Git PUSH, PULL, Clone
K
Hi, I’m Khushi Dubey. I work with Cloud and DevOps technologies, with a focus on AWS, Linux, Docker, Kubernetes, Terraform, and CI/CD. Here, I document my hands-on work, technical experiments, and things I learn while working with infrastructure and automation.

Step 1: What is GitHub and Git?

  • Git: Think of Git as a time machine for your files. It helps you save different versions of your work so you can go back to any version if something goes wrong.

  • GitHub: This is like a cloud storage for your code. It lets you store your projects online and collaborate with others.


Step 2: Install Git

Before you start, you need to install Git on your computer. Here’s how:

  1. Go to git-scm.com.

  2. Download the version for your operating system (Windows, Mac, or Linux).

  3. Follow the installation steps (just click "Next" if you're unsure).


Step 3: Create a GitHub Account

  1. Go to github.com.

  2. Sign up for a free account using your email address.

  3. Once you’re signed in, you’re ready to create your first repository!


Step 4: Create a Remote Repository on GitHub

A repository (or "repo") is like a folder for your project. Here’s how to create one:

  1. Click the + button in the top-right corner of GitHub and select New Repository.

  2. Give your repo a name (e.g., "my-first-project").

  3. Choose whether you want it to be Public (anyone can see it) or Private (only you can see it).

  4. Click Create Repository.


Step 5: Connect Your Local Project to GitHub

Now, let’s connect your computer to GitHub so you can upload your files.

  1. Open your terminal (Command Prompt on Windows, Terminal on Mac/Linux).

  2. Navigate to your project folder using the cd command. For example:

    Copy

     cd Desktop/my-project
    
  3. Initialize Git in your folder:

    Copy

     git init
    
  4. Add your files to Git:

    Copy

     git add .
    

    (The . means "add all files in this folder.")

  5. Save your changes with a message:

    Copy

     git commit -m "My first commit"
    

  1. Go back to your GitHub repo page and copy the remote repo URL (it looks like https://github.com/your-username/your-repo-name.git).

  2. In your terminal, link your local repo to GitHub:

    Copy

     git remote add origin https://github.com/your-username/your-repo-name.git
    
  3. Push your code to GitHub:

    Copy

     git push -u origin main
    

    (This uploads your files to GitHub.)


Step 7: Understanding Git Pull

Git Pull is like downloading the latest version of your project from GitHub. Here’s how it works:

  1. If someone else made changes to the repo, you can get the latest version by running:

    Copy

     git pull origin main
    
  2. This updates your local files with the changes from GitHub.


Step 8: Cloning a Repository

Cloning means downloading a copy of someone else’s repo to your computer. Here’s how:

  1. Go to the GitHub repo you want to clone.

  2. Click the Code button and copy the URL.

  3. In your terminal, run:

    Copy

     git clone https://github.com/username/repo-name.git
    
  4. This will create a folder on your computer with all the files from the repo.


Step 9: Recap of Key Commands

  • git init: Start tracking your project with Git.

  • git add .: Add all files to be saved.

  • git commit -m "message": Save your changes with a note.

  • git push: Upload your changes to GitHub.

  • git pull: Download the latest changes from GitHub.

  • git clone: Download a copy of a repo to your computer.


linkedin: https://www.linkedin.com/in/khushi-dubey-6036a2305

Thank You!

N

This is a good reminder. Sometimes the simplest ideas matter the most.