Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloning a Bitbucket repository via ssh

How do I clone a repository from Bitbucket via ssh instead of http? I already have git installed in my local machine (Windows).

like image 315
Sethu Avatar asked Oct 30 '19 10:10

Sethu


People also ask

How do I clone a Bitbucket repo in terminal?

Clone a Bitbucket repositoryClick + in the global sidebar on the left, and under Get to work select Clone this repository. Select HTTPS from the menu in the upper-right (unless you've already set up your SSH keys). Copy the clone command.

How do I clone a repository using SSH key?

Launch the SSH agent, run the “$ ssh-add ~/. ssh/id_rsa”, add the SSH public key into the agent, and copy it. Next, go to the “GitHub” settings, and add the SSH key. Lastly, open the repository, copy “SSH URL” and execute the “$ git clone” command with copied URL.


1 Answers

  1. Generate an SSH key: ssh-keygen -t rsa -C "your-email-address"
  2. Press Enter key until a randomart image is generated.
  3. Log into Bitbucket -> View profile -> Manage account -> SSH keys -> Add key
  4. Paste the key you have generated in Step 1 in the text box. To get the key, run the following command: cat ~/.ssh/id_rsa.pub
  5. Go to your repository -> Clone. Now you can see the SSH url for your repository. Copy it.
  6. Clone your repository: git clone <ssh-url>
like image 190
Joe Antony Avatar answered Sep 18 '22 14:09

Joe Antony