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.
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://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.
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).
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.
ssh-keygen
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/id_rsa.pub.
The key fingerprint is:
SHA256:/x/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx\xxxxxxx xxxxxx@xxxxxxxxxxxxxxxxxxx
The key's randomart image is:
+-----[RSA 2048]-----+
| |
| |
| |
| . . |
| . 0 . |
+------[SHA256]------+
There are two files generated under .ssh folder id_rsa (Private Key) and id_rsa.pub (Public Key), Copy the content of id_rsa.pub file content to clipboard.
dir C:\Users\xxxxxx/.ssh/ type C:\Users\xxxxxx/.ssh/id_rsa.pub type C:\Users\xxxxxx/.ssh/id_rsa.pub | clip
Once copied the public key data information, paste it on the Add public key box and click Add key.
This is how the Label and key looks like, Label contains domain\username@hostname.
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.
Useful Articles
Solved Visual studio Code make sure you configure your user.name and user.email 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 'https://github.com/UserName/repo.git/': The requested URL returned error: 403
Step by Step guide to push your first project to github.com
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