Uploading Existing Project to GitHub

Uploading Existing Project to GitHub

Initiate and upload your local git repo to GitHub using these steps.


2 min read

Hey there! You searched for this so I'm guessing you really need to know how to do this. (Or you're subscribed to my newsletter. If you're not...you're missing out bud. ๐Ÿ˜‰).

Let's get right to it then:

  1. Firstly, create your repository on the GitHub. Log into the GitHub website and click on the (+) symbol on the top right of the navigation bar.

  2. Give your repository a name, scroll down and click "Create Repository".

  3. In your command line (Command Prompt, Shell, etc), cd (change directory) into your project folder.

  4. If you haven't initiated Git, let's do so now. (Note, some JS frameworks initiate Git from the inception, so you can skip this step if that was already done).

$ git init -b main
  1. Add all of your files to the git repo you just initiated:
$ git add .
  1. Commit the files you just added to the repo:
$ git commit -m "First commit"
  1. You now have to connect your current local initiated git repository to github. You do so by adding the URL to the below command
$ git remote add origin <repo_url>
  1. Then verify the url
$ git remote -v
  1. Switch to main branch
$ git branch -M main
  1. Finalize this process now, by pushing the changes you've committed to GitHub
$ git push -u origin main

You can now refresh your GitHub repository page and you will see the files are uploaded. ๐Ÿ˜‰

Hope this helps with you with your project. This was something that puzzled me as well, so I'm happy to have shared this information with you. :)

Happy Coding! ๐ŸŽ‰โœจ