← Back to Git Course | Chapter 4: Remote Repositories | Lesson 9 of 11

Git Bitbucket Introduction

Bitbucket is another place to keep your Git projects online, like a different clubhouse that works especially well with the Jira task board.
Syntax
bash
git remote add origin https://bitbucket.org/user/repo.git
git clone https://bitbucket.org/user/repo.git

What is Bitbucket?

Bitbucket is Atlassian's Git hosting service, notable mainly for its tight native integration with Jira for issue tracking and Confluence for documentation -- you connect it to a local repository as a remote exactly like GitHub or GitLab.

Example: What is Bitbucket?

bash
git remote add origin https://bitbucket.org/user/repo.git

Cloning from Bitbucket

Cloning from Bitbucket works the same as any other host: grab either the HTTPS or SSH URL from the repository page and run git clone <url>, and Git configures the origin remote automatically.

Example: Cloning from Bitbucket

bash
git clone https://bitbucket.org/user/repo.git

Managing Remotes

If a Bitbucket repository's URL changes -- say, after a workspace rename -- git remote set-url origin <new-url> updates it without disturbing any local history; renaming the remote itself is a separate, optional step.

Example: Managing Remotes

bash
git remote set-url origin https://bitbucket.org/newworkspace/repo.git

Working with Bitbucket Pipelines

Bitbucket Pipelines is Atlassian's built-in CI/CD tool, configured through a bitbucket-pipelines.yml file committed to your repository, letting you define automated test and build steps that run on every push.

Example: Working with Bitbucket Pipelines

bash
echo "pipelines:\n  default:\n    - step:\n        script:\n          - npm test" > bitbucket-pipelines.yml

Setting Up SSH Keys

SSH keys let you authenticate to Bitbucket without typing a password on every push or pull -- once you've added your public key to your Bitbucket account, ssh -T [email protected] confirms the connection is working correctly.

Example: Setting Up SSH Keys

bash
ssh -T [email protected]
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
Common Mistakes
  1. Cloning with a URL copied from a different host or workspace, so git clone fails with a not-found or authentication error.
  2. Adding a remote with git remote add origin ... when origin already exists, instead of updating it with git remote set-url origin <new-url>.
  3. Entering your Bitbucket account password over HTTPS, when it expects an app password or access token.

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.