7 min read
📦intermediate

Working with GitHub — Sharing Code with the World

Learn how to push your code to GitHub, clone other projects, and collaborate with other developers online.

Git + GitHub = Superpowers

Git on your computer is great for tracking changes, but GitHub takes it to the next level. GitHub is a website that stores your Git projects online, letting you: - Back up your code in the cloud (never lose your work if your computer breaks) - Share your projects with anyone in the world - Collaborate with teammates on the same codebase - Showcase your work to future employers or schools (your GitHub profile is like a coding portfolio!) - Discover and learn from millions of open-source projects

Pushing to GitHub

bash
# 1. Create a repository on github.com first
# 2. Then connect your local project to it:
git remote add origin https://github.com/yourusername/myproject.git

# 3. Push your code to GitHub
git push -u origin main

# After the first push, just use:
git push

# To download a project from GitHub:
git clone https://github.com/someone/cool-project.git

# To get the latest changes from GitHub:
git pull

Cloning and Forking

Two key GitHub concepts: Cloning means downloading a copy of someone's project to your computer. You can look at the code, run it, and learn from it. If it is your own project, you can also push changes back. Forking means creating your own copy of someone else's project on YOUR GitHub account. This is how open source works — you fork a project, make improvements, and then submit a 'pull request' asking the original owner to include your changes. Thousands of developers collaborate this way on projects like Linux, Python, React, and VS Code!
Pro Tip

Your GitHub profile is your coding resume. Keep your repositories organized, write good README files that explain your projects, and make regular commits to show you are actively coding. Many companies and schools look at GitHub profiles when evaluating candidates!

Get on GitHub

If you do not have a GitHub account, create one at github.com (it is free!). Then: 1) Create a new repository called 'my-first-repo'. 2) Push a local Git project to it using the commands above. 3) Visit your project page on GitHub and check that your files are there. 4) Find an interesting open-source project and clone it to your computer. Explore the code! Bonus: Add a README.md file to your project explaining what it does.

Ready to build?

Put what you learned into practice — pick a project and start coding.

Start Building Free