Publish your work: push
Lesson 17 of 24 · Git.Micro
A remote is another copy of the repository, usually on a server such as GitHub or GitLab. git push sends your commits there so others can get them.
git remote add origin <url> gives the server a short name; origin is the usual one.
git push -u origin main sends main and sets upstream: from then on, git push alone is enough.
origin/main in the graph is your record of where main is on the server.
The server here is simulated in your browser, so nothing leaves this page.
What does -u do in git push -u origin main?
- Links your main to origin/main, so later git push and git pull need no arguments
- Updates the files on the server even with conflicts
An empty repository was created for you at https://git.micro/you/portfolio.git. Add it as the remote origin and push main to it, setting the upstream.
Do it in the browser: a real Git tool, a short mission and instant feedback. No install.
Start this lesson — free