Version Control and Git
Create Local Repository and push to Github
Initialize a Git Repository:
git init
to start git on a specified directory
Create and Add Files:
touch index.html
Add to Staging:
git add .
Commit the Changes:
git commit -m "Initial commit”
Add a Remote:
git remote add origin <GitHub_Repository_URL>
You can get the URL after you create a remote repo in Github
Push now:
💡 Because this is our first time pushing to this remote repository, we will need to use a special command. The exact command is easy to forget.
Thankfully, when we use git push
, Git will tell us what else we need to add to complete the command.
git push --set-upstream origin master