Git vs GitHub: What's the Difference and How They Work Together
Git is a version control program that runs on your computer and stores your project's change history. GitHub is a cloud service that hosts Git repositories and adds collaboration tools: pull requests, code review, issues, CI. You can use Git without GitHub, but not GitHub without Git.
People mix up Git and GitHub all the time, even though they operate at different levels. Git is a version control program you install on your computer: it records every saved state of your project and lets you go back to it. GitHub is a web service that hosts copies of Git repositories and builds collaboration tools around them. The easiest way to remember it: Git is the engine, and GitHub is the garage with a service shop where you can park that engine.
What is Git?
Git is a distributed version control system. Linus Torvalds created it in 2005 for Linux kernel development, and it has since become the industry standard. Git works entirely locally: the change history lives in a hidden .git folder inside your project, and most operations don't need an internet connection.
The key word here is "distributed." Every contributor has a full copy of the repository with its entire history on their machine, not just the latest files. If the server disappears, the project can be restored from any developer's machine.
What Git can do on its own:
- record changes as commits — snapshots of the project with an author, date, and description;
- show who changed a specific line, when, and why (
git log,git blame); - run parallel lines of development in branches and merge them;
- undo mistakes without losing the rest of your work;
- exchange history with other repositories via
git push,git pull, andgit fetch.
Git is a command-line tool. GUI clients and the panels built into editors (VS Code, IntelliJ IDEA) are just wrappers around the same commands.
What is GitHub?
GitHub is a cloud platform for hosting Git repositories, currently owned by Microsoft. You create a repository there, push your local code to it with git push, and it becomes available to your teammates, an employer, or the whole internet if the repository is public.
But GitHub's value isn't just storage. Around the repository, GitHub adds things Git itself doesn't have:
- Pull requests — requests to merge a branch, with discussion and line-by-line code review;
- Issues — tasks and bug reports tied to the project;
- GitHub Actions — CI/CD: automatically running tests, builds, and deploys on every push;
- access control — who can read, write, and merge into protected branches;
- developer profile — an activity graph and public projects that recruiters look at;
- GitHub Pages — free static site hosting straight from a repository.
Searches like "git com" or "git hub" usually mean this service — its address is github.com. The official site of Git itself is git-scm.com, where you download the installer.
Git vs GitHub: comparison table
| Criterion | Git | GitHub |
|---|---|---|
| What it is | Version control program | Web service for hosting repositories |
| Where it runs | On your computer | In the cloud, via browser and API |
| Needs internet | No, except for syncing with remote repositories | Yes |
| License | Open source (GPLv2), free | Proprietary service with free and paid plans |
| Interface | Command line, GUI clients | Website, GitHub Desktop app, gh CLI |
| Main job | Version history, branches, merges | Collaboration, review, CI, publishing code |
| Works without the other | Yes, completely | No, GitHub is built on Git |
How Git and GitHub work together
The link between them is a remote — a remote repository. Your local repository stores the address of the GitHub repository under a short name, origin by default. From there, syncing comes down to three commands:
git push— send your new commits to the server;git fetch— download other people's commits without touching your files;git pull— download changes and immediately integrate them into the current branch (essentiallyfetch+mergeorrebase).
Important: GitHub can't see your code until you push it. A commit exists only locally until your first git push. Hence the classic beginner complaint: "I committed, but there's nothing on GitHub."
The typical path: from a local project to GitHub
# 1. Create the repository locally
cd my-project
git init
git add .
git commit -m "Initial commit"
# 2. Create an empty repository on github.com (no README),
# copy its URL and add it as a remote
git remote add origin git@github.com:username/my-project.git
# 3. Rename the branch to main and push
git branch -M main
git push -u origin main
The -u flag (long form --set-upstream) links your local main branch to the remote one. After that, plain git push and git pull with no arguments are enough.
The other way around: start from a GitHub repository
If the project already lives on GitHub, you don't recreate it — you clone it:
git clone https://github.com/username/my-project.git
cd my-project
This downloads the entire history and sets up the origin remote automatically.
Authentication: SSH or HTTPS
Since 2021, GitHub no longer accepts your account password for Git operations over HTTPS. There are two working options.
HTTPS + Personal Access Token. You create a token in your account settings (Settings → Developer settings) and enter it instead of a password. To avoid typing it every time, Git uses a credential manager — on Windows it's installed along with Git for Windows.
SSH keys. This is the option employers expect you to be able to set up yourself:
# Generate a key
ssh-keygen -t ed25519 -C "you@example.com"
# Print the public key and add it to GitHub:
# Settings → SSH and GPG keys → New SSH key
cat ~/.ssh/id_ed25519.pub
# Test the connection
ssh -T git@github.com
On success, GitHub greets you by username and notes that it doesn't provide shell access — that's expected. Use the repository URL in the git@github.com:user/repo.git format, not https://.
If the repository is already connected over HTTPS, you can switch it to SSH with a single command:
git remote set-url origin git@github.com:username/my-project.git
GitHub vs GitLab and others: what's the difference?
GitHub isn't the only Git host. They all use the same Git, so you can move a repository from one to another without losing history. What differs is the tooling around the code.
| Service | Highlights | When people choose it |
|---|---|---|
| GitHub | The largest open source community, GitHub Actions, Copilot | Portfolios, open source projects, most startups |
| GitLab | Built-in CI/CD out of the box, can run on your own server (self-hosted) | Companies that need code kept inside their own infrastructure |
| Bitbucket | Integration with Jira and other Atlassian products | Teams living in the Atlassian ecosystem |
| Gitea, Forgejo | Lightweight open source self-hosted solutions | Small teams, home servers |
GitLab calls it a merge request, GitHub calls it a pull request, but the idea is the same: propose changes from a branch and discuss them before merging. Different terminology, identical Git commands.
A single local repository can have several remotes at once — for example, to mirror a project on both GitHub and GitLab:
git remote add gitlab git@gitlab.com:username/my-project.git
git push gitlab main
git remote -v
Do I need GitHub if I work alone?
Technically, no: Git works perfectly well locally. But even for a solo project, a remote repository has three big advantages.
- Backup. If your laptop dies, your code and its entire history are safe on the server.
- Working from multiple devices. At home and at the office, you sync with
pushandpull. - Portfolio. When hiring for junior roles, companies often look at your GitHub profile before your resume: are there real projects, meaningful commit messages, a README?
Where should a beginner start?
You don't need to learn Git and GitHub at the same time — order matters. First master the local workflow: git init, git status, git add, git commit, git log, branches, and merging. Once that works without a cheat sheet, sign up for GitHub, set up SSH, and learn push, pull, and fetch. The last step is the team workflow: fork, a branch per task, pull request, review.
What employers look for in your GitHub
The green activity squares aren't the main thing. An experienced reviewer spends a couple of minutes checking other things:
- clear commit messages instead of "fix", "123", or "changes";
- small, logical commits rather than one giant "uploaded the project";
- a README explaining how to run the project;
- a
.gitignorefile: nonode_modules,.envwith passwords, or IDE files in the repository; - branches and pull requests even in learning projects — this shows you know the team workflow.
Common beginner mistakes
"fatal: not a git repository"
You're running a Git command outside a repository. Change into the project folder or run git init. Your GitHub account has nothing to do with it — this is a local Git error.
"Permission denied (publickey)"
Your SSH key hasn't been created, hasn't been added to GitHub, or isn't loaded into ssh-agent. Run ssh -T git@github.com and check the key list in your account settings.
"rejected … (fetch first)" on push
The server has commits you don't — for example, you created the GitHub repository with a README. Pull the changes first: git pull --rebase origin main, then retry git push. Don't use --force until you understand whose work you'd be overwriting.
Secrets in a public repository
A password or API key that ever made it into a commit stays in the history, even if you delete the file later. Rotate such a key immediately, and add .env to .gitignore up front.
Summary
Git is the version control tool on your computer; GitHub is the service where those repositories live in the cloud and where team collaboration happens around them. GitLab, Bitbucket, and the rest are alternatives to GitHub, not to Git: under the hood, they all use the same commits, branches, and commands. Start with local Git, then add a remote and set up SSH. Connecting a local repository to GitHub, plus push, pull, and fetch, are covered hands-on in our Git course.
FAQ
Is GitHub free?
Yes, the free plan lets you create unlimited public and private repositories. Paid plans add advanced team features and more GitHub Actions minutes for private projects.
Can I use GitHub without the command line?
Yes, through GitHub Desktop or the Git panels built into editors. But these tools run the same Git commands, so understanding them is still useful, especially when conflicts arise.
Do I need to install Git if I have a GitHub account?
Yes. The account gives you storage, but you'll work with code locally — commits, branches, push — through an installed Git.
How do I move a repository from GitHub to GitLab?
Add a new remote and push all branches and tags: git push gitlab --all and git push gitlab --tags. The full history moves over, because both services run on Git.
What's the difference between a public and a private repository?
A public repository is visible to everyone on the internet; a private one only to you and invited collaborators. For a portfolio, you need public repositories.
This topic is covered in depth with practice in the course “Git from Scratch to Confident Developer”.
- Why Git is Essential - And Why It's a Job Requirement
- GitHub and Remote Repositories: Your Code in the Cloud