How to upload an existing project to GitHub

Feb 25, 2024

Let's be honest, even seasoned developers sometimes have those brain-fog moments. If you've ever found yourself staring at the command line, wondering how to get your project onto GitHub, you're not alone. Uploading projects can feel tricky, especially if you haven't done it in a while. Don't worry, we're here to refresh your memory and make the process a breeze.

How to clone a Repository

Cloning is your first step towards customising and improving existing code.

Type git clone, and then paste the URL of the repository

git clone {Github repo link}

Press Enter to create your local clone (it should look like this)

$ git clone {GitHub repo link}
> Cloning into `directory`...
> remote: Counting objects: 10,
done.
> remote: Compressing objects: 100% (8/8),
done.
> remove: Total 10 (delta 1),
reused 10 (delta 1)
> Unpacking objects: 100% (10/10),
done.

Push and Merge Existing Projects

This guide covers the basics of integrating an existing project into a remote Git repository. These are the steps that we will be following in the command line:

  1. Initialize a local Git repository
  2. Stage your files for tracking
  3. Create your first commit
  4. Connect your repository to a remote location
  5. Push your local changes to the remote repository

Your Terminal should look like this

git init
git add .
git commit -m "commit comment"
git remote add origin {Github repo link}
git push -u origin master

Mastering these commands might seem small, but they open up a world of version control possibilities. Remember, practice makes perfect!