What is GitHub and How to Use It?
Short answer: GitHub is a website and service for hosting Git repositories online. It adds collaboration tools on top of Git, such as pull requests, issues, code review and automation, so teams and open source communities can build software together.
Git vs GitHub
| Git | GitHub | |
|---|---|---|
| What it is | A version control tool on your computer | A cloud platform that hosts Git repositories |
| Works offline | Yes | No, it is an online service |
| Main purpose | Track changes to files | Share, review and manage code with others |
You need Git to use GitHub effectively. If it is new to you, read what Git is first. Alternatives with similar features include GitLab and Bitbucket.
Main features
- Repositories: a project's files and history, public or private.
- Pull requests: propose changes and get them reviewed. See pull requests explained.
- Issues and Projects: track bugs, tasks and plans; see issues and project management.
- Actions: automate tests and deployments; see GitHub Actions CI/CD.
- Pages: free static site hosting from a repository.
- Security tools: Dependabot alerts and updates, secret scanning and code scanning.
- Discussions and Codespaces: community Q&A and cloud development environments.
Get started in six steps
- Create an account at github.com and enable two-factor authentication.
- Create a repository with the New button. Add a name, choose public or private, and optionally add a README and license.
- Install Git on your computer and set your identity:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
- Connect your project to the repository and push:
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/YOUR-NAME/my-project.git
git push -u origin main
- Authenticate: GitHub no longer accepts account passwords for Git operations. Use an SSH key, GitHub CLI login or a personal access token.
- Refresh the page to see your files online.
A shorter walkthrough is in how to upload a project to GitHub.
A simple team workflow
- Create a branch for each task:
git checkout -b add-login. - Commit your work and push the branch.
- Open a pull request and ask a teammate to review.
- Fix review comments, wait for automated checks to pass, then merge.
- Delete the merged branch.
Public or private?
| Type | Visible to | Good for |
|---|---|---|
| Public | Everyone | Open source, portfolios, learning |
| Private | You and people you invite | Client work, company code |
Never commit passwords, API keys or .env files, especially to public repositories. Use a .gitignore file and rotate any secret that leaks.
Why developers use GitHub
- A backup of your code outside your computer.
- A public portfolio that employers can see.
- The home of most open source projects; learn to join them in how to contribute to open source.
- Built-in automation and hosting for small sites.
Make your repository welcoming
Write a clear README (see README best practices), add a license and describe how to contribute.
Free and paid plans
A free account includes unlimited public and private repositories with limits on some features such as Actions minutes. Organizations and larger teams can upgrade for more controls. Check GitHub's pricing page for current limits.
