Virtual Geek

Tales from real IT system administrators world and non-production environment

Logging and Working on BitBucket using Git SSH url

This is step by step guide to configuration bitbucket with SCM GIT.exe. I wanted to clone remote BitBucket code repository from server to the local system for script code update/changes and push the changes. The first task is to grab bitbucket repository url, loggin to bitbucket and  click on the clone icon (left side). I wanted to test SSH connection (another option is https). Copy the url link of BitBucket repository. 

Bitbucket git bash git clone ssh https clone in sourcetree free git mercurial client for windows and mac ssh git watch browser github.png

I have already installed scm git software, Using below command with bitbucket repository url to clone it locally, but was receiving Permission denied error with to make sure I have correct access rights or repository exists.

git clone ssh bitbucket 7999 git clone permission denied publickey fatal could not read from remote repository correct access rights error repository exists.png

git clone ssh://git@xxxxxxxxxxxxxxx:xxxx/xxxx/xxxxxxxxxxxxxxxxxxx.git
Cloning into 'xxxxxxxxxxxxxxxxxx' ...
git@xxxxxxxxxxxxxxxxxxxxxxx: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I had neccessory access which was accessible from portal, This is authentication error when trying from git commands. To solve this issue Click on the User Profile (top right side), from drop down Choose Manage account.

Bitbucket search for code commits or repositories manage account view profile altassian marketplace bitbucket git hub ssh git.exe.png

Select SSH keys from navigation pane, click Add key (As no SSH key has been added I will add one. Adding ssh keys are simple and it connets safely to repositories).

bitbucket account settings ssh keys no ssh keys have been added code commits repositories add gpg keys personal access tokens fid management authorized applications git hub.png

Before Adding key need to generate SSH key. In the Powershell or Cmd prompt execute ssh-keygen command, it generates public and private rsa key pair under C:\Users\userprofilefolder\.ssh folder.

Windows Powershell Git Bitbucket github ssh-keygen generate public private rsa key pair directory users .ssh passphrase fingerPrint randomart image.png

Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\xxxxxxxx/.ssh/id_rsa):
created directory 'C:\Users\xxxxxxxxx/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\xxxxxxxxx/.ssh/id_rsa.
Your public key has been saved in C:\Users\xxxxxxxxxx/.ssh/
The key fingerprint is:
SHA256:/x/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx\xxxxxxx xxxxxx@xxxxxxxxxxxxxxxxxxx
The key's randomart image is:
+-----[RSA 2048]-----+
|                    |
|                    |
|                    |
|        . .         |
|      .  0  .       |

There are two files generated under .ssh folder id_rsa (Private Key) and (Public Key), Copy the content of file content to clipboard.

dir C:\Users\xxxxxx/.ssh/
type C:\Users\xxxxxx/.ssh/
type C:\Users\xxxxxx/.ssh/ | clip

Microsoft powershell get-content cat type  users .ssh clip clipboard view file notepad bitbucket add ssh keys token account settings gpg keys personal access tokens authorized applicationsfid management.png

Once copied the public key data information, paste it on the Add public key box and click Add key.

Bitbucket chrome code commits or repositories ssh-rsa ssh keys public private keys ssh keys clipboard properties bitbucket git github devops operations sre.png

This is how the Label and key looks like, Label contains domain\username@hostname.

Bitbucket account settings change password notification settings ssh keys gpg keys watched repositories personal access tokens authorized applications fid management ssh-rsa metadata bitbucket rsa fingerprints.png

Now its time to test git clone with below command again and it is successful.

git clone ssh://git@xxxxxxxxxxxxxxx:xxxx/xxxx/xxxxxxxxxxxxxxxxxxx.git
Cloning into 'xxxxxxxxxxxxxxxxxx' ...
The authenticity of host '[xxxxxxxxxxxxxxx]':xxxxx ([xxxxxxxxx]:xxxx)' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[xxxxxxxxxxxxxxxxxxx]:xxxxx,[xxxxxxxxxx]:xxxxx' (RSA) to the list of known hosts.
remote: Enumerating objects: xxxx, done.
remote: Counting objects: 100% (xxxx/xxxx), done.
remote: Compressing objects: 100% (xxxx)
Receiving objects: xx% (xxxx/xxxx), xx.xx Kib | xxx.xx KiB/s xxx (delta xxx), reused x (delta x)
Receiving objects: 100% (xxxx/xxxx), xx.xx Kib | xxx.xx KiB/s, done.
Resolving deltas: 100# (xxx/xxx), done.

Microsoft Powershell bitbucket git github ssh git clone authenticity of host rsa key fingerprint is sha256 enumerating objects remote counting compressing objects receiving github pull push fetch git.png

Useful Articles
Solved Visual studio Code make sure you configure your and in git
Part 1 Git version control integration in Visual Studio Code
Part 2 Git master branch source control integration in Visual Studio Code
Part 3 Git clone version control integration in Visual Studio Code
Remote: Permission to UserName/repo.git denied to OtherUserName fatal: unable to access '': The requested URL returned error: 403
Step by Step guide to push your first project to
How to install Ansible on Linux for vSphere configuration
How to Setup Passwordless SSH Login on Windows
configure remote ssh extension on visual studio code
VS code remote ssh could not establish to host, connecting was canceled

Go Back


Blog Search

Page Views


Follow me on Blogarama