So you made a local Git repo and now you want to shove it onto a remote without summoning demons. Good plan. This guide walks you through registering a remote named origin and pushing your branch so GitHub or your favorite host can admire your code.
If you do not already have a repository run git init or check with git status. Stage and commit your work so you have something worth sending into the cloud.
git init
git add .
git commit -m "Initial commit"
If you already had commits you are fine to skip the init step and proceed to adding a remote.
The command is straightforward. Replace the placeholder with the URL your hosting service gave you. You can use HTTPS or SSH depending on how you authenticate.
git remote add origin [remote URL]
That registers the name origin and points it at the remote repository. No magic, just a friendly pointer so Git knows where to push and fetch.
If your main branch is called main do this. If it is master or something else replace main with that branch name.
git push -u origin main
The -u flag sets the upstream so future pushes are as lazy as you want them to be. After this you can run git push and Git will know where to send commits for that branch.
Make sure origin points where you expect it to point.
git remote -v
git branch -vv
The first command lists remotes and their URLs. The second shows what upstream each branch is tracking. Both are quick sanity checks before you rage at Git.
Initialize or confirm your local repo, add a remote with git remote add origin, push your branch with git push -u origin main, and verify with git remote -v and git branch -vv. If something fails check credentials and bring your branch up to date before trying again. Now go forth and push, and try not to break the build.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.