Uploading to Mission Control
You've made commits locally. Now it's time to send them to GitHub with git push—uploading your work to the cloud.
Creating a GitHub Repository
- Go to GitHub and click "+" → "New repository"
- Name it (e.g., "my-first-mission")
- Choose public or private
- Don't initialize with README (you already have one locally)
- Click "Create repository"
Connecting Local to Remote
Add the remote repository:
git remote add origin git@github.com:username/my-first-mission.git
Replace username with your GitHub username.
origin is the conventional name for your main remote repository.
Verifying Remote
git remote -v
Should show your GitHub URL for both fetch and push.
Your First Push
git push -u origin main
The -u flag sets upstream tracking, so future pushes can just be git push.
Understanding Push
Push uploads:
- All new commits
- Referenced objects
- Updates remote branch pointers
It doesn't upload:
Subsequent Pushes
After the initial push with -u:
git push
That's it! Git remembers where to push.
Pushing Other Branches
git push origin feature-branch
Force Push (Dangerous!)
git push --force
Warning: Overwrites remote history. Only use when absolutely necessary and you're sure no one else is using the branch!
Common Push Errors
"Updates were rejected"
Someone pushed changes before you. Pull first, then push:
git pull
git push
Permission Denied
Check your SSH keys or repository permissions.
Pushing Tags
git push --tags
Viewing on GitHub
After pushing, visit your repository on GitHub. You'll see your code, commits, and history—all backed up in the cloud!
Best Practices
- Push frequently (at least daily)
- Push after completing features
- Never push secrets or credentials
- Review changes before pushing
- Don't force push to shared branches
Next: Receiving Transmissions
You can now send your work to GitHub. Next, we'll learn to pull changes from GitHub—receiving updates from teammates and other devices.