Summary
This post is a step by step instruction on how to push an existing Visual Studio Code project to Github. I'll demonstrate steps from both the GUI and command line to accomplish this.Step 1: Create the Github Repository
Screen-shot below of a basic repo. Note that I use Github's stock Node.js .gitignore file.Resulting repo:
Step 2: Create a Local Git Repository
Command-line and GUI methods below:$ git init .
Step 3: Add Remote (Github) Repository
git remote add origin https://github.com/joeywhelan/containertest
Step 4: Pull from Github
This step will pull down the existing files in the start-up repo - most importantly, the .gitignore file.Command-line + GUI methods:
$ git pull origin main
Result below. Note all the untracked files from the node_modules directory are now hidden via the .gitignore from Github.
Step 5: Add all of the local files to the local Git Staging Area
$ git add .
Results:
Step 6: Commit all to the local Git repo.
$ git commit -m "first commit" .
Results:
Step 7: Rename the local 'master' branch to main and push local files to Github.
$ git branch -m master main $ git push -u origin main
Results:
Copyright ©1993-2024 Joey E Whelan, All rights reserved.