Uploading Existing Project to GitHub

Uploading Existing Project to GitHub

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

Stephon Fraser's photo
Stephon Fraser
ยทMar 11, 2022ยท

2 min read

Subscribe to my newsletter and never miss my upcoming articles

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. Screenshot 2022-03-08 at 5.48.57 PM.png

  2. Give your repository a name, scroll down and click "Create Repository". Screenshot 2022-03-08 at 5.51.53 PM.png

  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
    
  5. Add all of your files to the git repo you just initiated:

    $ git add .
    
  6. Commit the files you just added to the repo:

    $ git commit -m "First commit"
    
  7. 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>
    
  8. Then verify the url

    $ git remote -v
    
  9. 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! ๐ŸŽ‰โœจ

ย 
Share this