set up git repo
set up a Git repository to track and push changes from your CLI
· by Aron Kovacs
1. add a remote repository
Link your local project to GitHub with:
git remote add origin https://github.com/yourusername/yourrepository.git
This sets up "origin" as the alias for your remote repository.
2. rename branch to main
Rename the current branch to main (Git's default primary branch):
git branch -M main
3. push to remote
Upload your local commits to the remote main branch:
git push -u origin main
4. commit & push your changes
After making changes, use these commands to update your GitHub repository:
git add . # Stage all changes
git commit -m 'your-message' # Commit with a message
git push # Push to GitHub
Note: Regularly push changes with clear commit messages for easier tracking and reverting (if needed)