This is the first repository I ever made and I am learning the proper way to utilize GitHub.
- Open your browser and go to https://github.com
- Log in
- In the top-right corner, click the + plus icon
- Click New Repository On the "Create a new repository" page:
- Name the repository
- Description (optional)
- Choose Public or Private
- Important we want the repo completely empty
- Click "Create Repository"
-
Open project in VS Code
-
In VS Code open a new terminal
-
git init
you should see a message confirming the inialized Git repository.
-
in the terminal add
git add . -
then commit files:
bash git commit -m " initial Commit" -
If this is your first time running git you may need to add your account info
git config --global user.name "Your Name" git config --global user.email "you@example.com"
-
Connect your local folder to GitHub Go back to the Github page that you left open.
You should see a section called "... or push an existing repository from the command line" Copy only the line that looks like this (example):
git remote add origin https://github.com/yourusername/my-first-project.git
Paste in the VS Code terminal and press Enter
-
Push your code to GitHub
git branch -M main
git push -u origin main
-GitHub may open a browser window asking you to log in -approve the conection
- Go back to your GitHub repo page
- Refresh the page Your files Should now be there!
git add .
git commit -m "Describe what you changed"
git push