Git vs GitHub, GitLab and Bitbucket

Updated · 10 min read
easyGit 2.53gitgithubgitlabbitbucketinterview

"I put it on Git." "Is it on GitHub?" "Send me the Git link." New developers hear these sentences on their first day and often conclude that Git and GitHub are two names for one thing. They are not, and mixing them up causes real confusion later.

Here is a comparison that helps. A camera takes photos and keeps them in an album at your home. A photo-sharing website is where you upload that album so your family can see it and add their own photos. The camera works perfectly well without the website. The website would have nothing to show without cameras.

Git is the camera. GitHub, GitLab and Bitbucket are photo-sharing websites. This lesson explains what each one does and how the three websites compare.

Git Is the Tool

Git is a version control program that runs on your own computer. It records commits, keeps the history, creates branches and combines them. It needs no account and no internet connection, and it is free and open source. No company owns it.

Everything you learned in the lesson "What Is Git" was Git alone. Navika created a repository and made commits, and no website was involved.

GitHub, GitLab and Bitbucket Are Hosting Services

A hosting service is a website that stores a copy of your Git repository on its servers. That online copy is what Git calls a remote. A hosting service is used to:

  • share a repository, so that everyone on the team pushes to and pulls from one agreed place;
  • back up your work somewhere other than your laptop;
  • review changes before they are accepted, using a pull request (a page where teammates read and discuss a proposed change);
  • track bugs and tasks as issues;
  • run automatic checks, such as building the project and running its tests after every push;
  • control access, so the right people can read or change each repository.
Git runs on each computer; a hosting service holds the shared copy

Pull requests, issues and automatic checks are features of the websites. They are not part of Git, which is why they look a little different on each service.

Git vs GitHub at a Glance

GitGitHub (and GitLab, Bitbucket)
What it isA version control programA website that hosts Git repositories
Where it runsOn your computerOn the company's servers, in your browser
First released2005GitHub in 2008
Owned byNobody; it is an open-source projectA company
Needs internetNoYes
Needs an accountNoYes
Main jobRecord and manage historyShare repositories and help teams work together
You use it throughThe git command, or an editor that runs itA web page, plus git push and git pull

Proof That Git Works Without a Website

Navika creates a new repository and makes one commit. Then she asks Git to list its remotes with git remote -v:

Terminal
mkdir fee-tracker
cd fee-tracker
git init --quiet
echo "Fee Tracker" > README.md
git add README.md
git commit --quiet -m "Add project README"
git remote -v
git log --oneline
Output
dd34d8a (HEAD -> main) Add project README

How it works

  1. --quiet asks git init and git commit to do their work without printing a message, so the output stays short.
  2. git remote -v prints nothing, because this repository has no remote. It isn't connected to any website.
  3. git log --oneline still shows the commit. The history is complete and it lives on Navika's computer.

A repository is a full repository from its first commit. A hosting service is something you add when you want to share.

Comparing the Three Hosting Services

GitHub, GitLab and Bitbucket all host Git repositories, and the Git commands you type are the same for all three. They differ in who runs them and in the features built around Git.

GitHubGitLabBitbucket
Launched200820112008
Owned byMicrosoft (since 2018)GitLab Inc.Atlassian (since 2010)
Known forThe largest home of open-source codeOne product for the whole process, from planning to releaseWorking closely with Jira and other Atlassian tools
Name for a proposed changePull requestMerge requestPull request
Built-in automationGitHub ActionsGitLab CI/CDBitbucket Pipelines
Run it on your own serversGitHub Enterprise ServerGitLab Self-Managed (has a free, open-source edition)Bitbucket Data Center
Free planYesYesYes

A pull request on GitHub and Bitbucket and a merge request on GitLab are the same idea with two names: "please review my changes and add them to the main branch".

This course uses GitHub for its main examples. Where the steps on GitLab or Bitbucket are different, the lesson shows them side by side in tabs.

Do You Need a Hosting Service?

Not to learn Git. Every lesson until "Git Remote" works with a repository on your own computer.

You will want one when:

  • you work with other people, because everyone needs a shared place to push to and pull from;
  • you want a backup that survives a lost or broken laptop;
  • you want to show your work to others, for example in a job application;
  • you want to contribute to an open-source project.

Common Mistakes

Saying "I installed GitHub". You install Git. GitHub is a website you sign in to. There is an app named GitHub Desktop, but it is a window with buttons that runs Git for you.

Thinking a commit is on GitHub. git commit saves to the repository on your computer. Your work reaches GitHub only when you run git push. If your laptop is lost before you push, the website has nothing.

Thinking Git needs GitHub. Git was released in 2005 and GitHub in 2008. Git works alone, with any hosting service, or with a plain server that your company runs.

Believing the website is the "real" copy. Your local repository is a complete repository with the full history. The copy on the hosting service is special only because the team agreed to share through it.

Expecting pull requests in Git. A pull request is a feature of the hosting website. Git has no git pull-request command for opening one, and the name is different on GitLab.

Interview Corner

What is the difference between Git and GitHub?

Git is a distributed version control system: a program that runs on your computer and records the history of a project. GitHub is a web-based hosting service for Git repositories. It stores a remote copy of the repository and adds features for teams, such as pull requests, code review, issues and automation. Git works without GitHub, but GitHub is built on Git.

Can you use Git without GitHub?

Yes. Git is complete without any hosting service. You can create repositories, commit, branch and merge entirely on your own computer. To share work, a team can use GitHub, GitLab, Bitbucket, or a Git server it runs itself.

What is the difference between a pull request and a merge request?

They are the same thing with different names. GitHub and Bitbucket call it a pull request, and GitLab calls it a merge request. In both cases, a developer pushes a branch and asks the team to review it and merge it into another branch, usually main.

Name some alternatives to GitHub.

GitLab and Bitbucket are the best-known. Others include Azure DevOps Repos and self-hosted options such as Gitea and Forgejo. All of them host Git repositories, so the Git commands stay the same.

Practice

Sort these into "Git" or "hosting service". Decide for each one, then check your answers.

  1. Saving a commit
  2. Opening a pull request
  3. Creating a branch
  4. Reporting a bug as an issue
  5. Looking at the history while you are offline
  6. Giving a teammate permission to read a private repository
Show the answers

Git: 1 (saving a commit), 3 (creating a branch), 5 (looking at the history offline). Hosting service: 2 (opening a pull request), 4 (reporting an issue), 6 (giving a teammate access).

Challenge: connect a repository to a remote. Continue the session from this lesson. The command git remote add origin <address> gives your repository the address of a remote and names it origin. Add the address https://github.com/your-username/fee-tracker.git, then list the remotes again.

What does Git print? Before you open the solution, decide what git remote -v shows this time. Has anything been uploaded?

Show solution
Terminal
git remote add origin https://github.com/your-username/fee-tracker.git
git remote -v
Output
origin	https://github.com/your-username/fee-tracker.git (fetch)
origin	https://github.com/your-username/fee-tracker.git (push)

git remote -v now lists origin twice: once as the address to download from (fetch) and once as the address to upload to (push). Nothing has been uploaded. git remote add only saves an address in your local repository, and it doesn't contact the website at all. The commit goes to GitHub when you push, which you will do in the lessons on remote repositories.

Quick check: Git vs GitHub

4 questions
1Which statement is correct?
2What does GitLab call a pull request?
3Navika commits her work and closes her laptop without pushing. What is on GitHub?
4Which of these is a feature of a hosting service and not of Git?

Key Takeaways

Quick reference

CommandIt is used to
git remote -vList the remotes of a repository and their addresses
git remote add origin <address>Save the address of a remote under the name origin
git init --quietCreate a repository without printing a message

Was this tutorial helpful?

Lesson 3 of 106