What you will learn
- Create a GitHub repository and connect it as a remote
- Send and receive changes with git push and git pull
- Clone an existing repository and write a helpful README
Git works locally, but most teams also keep a shared copy of each repository online. GitHub is the most widely used hosting service for Git repositories. It stores your code, shows its history in the browser and adds tools for collaboration. After creating an empty repository on GitHub, you link your local project to it with git remote add origin followed by the repository URL.
git push sends your local commits to the remote, and git pull fetches commits other people have pushed and merges them into your copy. The first push of a branch usually needs git push -u origin main to set the default destination. To start working on someone else's project, git clone downloads the full repository and its history in one step.
GitHub needs to know who you are. You sign in with your account, then authenticate from the terminal using an SSH key or a personal access token, as GitHub no longer accepts your account password for Git operations. Add a README.md file to every repository explaining what the project is, how to run it and what it uses. It is the first thing visitors see.


