Source Code Management Git Could Not Read From Remote Repository. Return Status 128

How to set up - git@github.com permission denied (publickey). fatal could not read from remote repository and Support for countersign authentication was removed. Please apply a personal access token instead

git@github.com: Permission denied (public key).fatal: Could not read from remote repository. - It means GitHub is rejecting your connexion because -

  1. It is your private repo
  2. GitHub does not trust your computer because it does non have the public primal of your computer.

And when you lot effort to clone the repo you get the post-obit error message -

                              onegit@github.com: Permission denied                (public key).                twofatal: Could not                read                from remote repository.                iii                4Delight brand certain you lot take the correct access rights                5and the repository exists.                          

Not only github but y'all tin face up this issue on the platform like GitLab, DigitalOcean, here I accept equanimous the list of possible solutions -

  1. GitHub - How to fix git@github.com: Permission denied (public key)?
  2. GitLab - How to fix gitlab.com: permission denied (publickey) fatal: Could not read from remote repository
  3. BitBucket - Permission denied (public key), can't clone/clone to bitbucket
  4. Personal Access Token - How to set(GitHub)-Support for countersign authentication was removed. Please use a personal access token instead



1. GitHUb - How to fix this effect?

Footstep 1 - Create SSH key pair

One of the easiest ways for you to generate a key pair is by running ssh-keygen utility.

Open the control prompt and type in the post-obit

(Note - If yous exercise non have ssh-keygen installed on the window and then Click here.)

To continue the ssh-keygen uncomplicated, do not enter whatsoever key name or passphrase.

                                                1Generating public/private rsa key pair.                                  2Enter file in which to relieve the key                (/Users/rahulwagh/.ssh/id_rsa):                                  threeEnter passphrase                (empty                for                no passphrase):                                  fourEnter aforementioned passphrase once again:                                  fiveYour identification has been saved in /Users/rahulwagh/.ssh/id_rsa.                                  6Your public key has been saved in /Users/rahulwagh/.ssh/id_rsa.pub.                                  viiThe key fingerprint is:                                  8SHA256:Okq3w+SesCGLQVToSBQru8RdUZtT2EIIrzH5MQ67DWA rahulwagh@local                                  9The central's randomart image is:                x+---[RSA 3072]----+                11                |.ooo..+oo.                |                12                |                oo o..o+.                |                thirteen                |                =                Due east                =                =                +.                |                14                |*oo X o .                |                15                |.+                =                o  Southward                |                16                |o.  + ..                |                17                |o ..+=+                |                xviii                |                o + *++                |                xix                |. . o.+.                |                xx+----[SHA256]-----+                          

Where to find the central pair

The file will be generated at - /Users/rahulwagh/.ssh/

Name of the file - id_rsa.pub

(To generate SSH keys on Windows machine click here)


Step 2 - Adding SSH key to your GitHub account

  1. Goto your GitHub Business relationship -> Settings

  1. Then expect for SSH and GPG keys under **Business relationship Settings -> SSH and GPG keys **

  1. After that click on New SSH Key . Assign some meaningful name to your primal

  1. To get the cardinal goto to your command prompt and switch directory path

Windows - C:\Users\rahulwagh.ssh\id_rsa.pub

Linux - /Users/rahulwagh/.ssh/id_rsa.pub

Run the post-obit command

  1. Copy the content of the cardinal

  2. Paste the key inside your GitHub account

Now you can clone your GitHub repo and it volition not complain nigh git@github.com permission denied (publickey). fatal could not read from remote repository


Benefits of this approach
  1. Y'all do not need to supply you GitHub Username and password
  2. More secured

Drawback
  1. The process of generating SSH keys is little troublesome.
  2. If y'all switch your laptop/desktop so yous need re-generate the SSH keys again and perform the aforementioned steps onto your new laptop/desktop.


Arroyo 2 : Using GitHub HTTPS urls

This is one more than approach in which you do not need to worry most SSH key generation.

You need following -

  1. GitHub repo URL with HTTPS (Ex - https://github.com/rahulwagh/example.git)
  2. Your GitHub Username
  3. Your GitHub Password

Run the post-obit command to set git remote

                              1git clone origin https://github.com/rahulwagh/case.git                          

Later that information technology will ask for your username and countersign, supply your username and countersign.

Once y'all are authenticated then you lot tin perform your Git operations.


Benefits of this approach
  1. You practise non need to generate SSH keys
  2. You do not demand to copy your SSH keys to GitHub accounts
  3. This approach tin can be used from whatsoever Laptop, Desktop. Y'all only need to provide your GitHub credentials with this arroyo.

Drawback
  1. The only drawback which I can see is y'all demand to input your GitHub credentials everytime.


2.one Multiple public keys inside ~/.ssh directory?

When you lot are working with multiple github repositories then there is loftier probability that you might have incorrect public central mentioned inside your ~/.ssh directory.

For case I have generated the public key for my GitLab project by the name ~/.ssh/id_rsa.gitlab.pub

Just when I checked my ~/.ssh/config file I noticed the wrong name of public key for the gitlab.com

Here is the content of my ~/.ssh/config file where the public key name is ~/.ssh/id_rsa instead of ~/.ssh/id_rsa.gitlab.pub

                              iHost gitlab.com                ii                Preferredauthentications publickey                iii                IdentityFile ~/.ssh/id_rsa                          

How to fix?

To fix this issue y'all should correct the public primal proper noun -

                              iHost gitlab.com                2                Preferredauthentications publickey                three                IdentityFile ~/.ssh/id_rsa.gitlab.pub                          


3. Bitbucket - Permission denied (public primal), can't clone/clone to bitbucket

There could be multiple reasons behind the effect -


three.1 You did not add your local SSH keys to BitBucket Settings

SSH keys could be one of the nearly probable reasons which are causing the issue while working with your BitBucket repository.

You might meet the following errors -

                              1Permission denied                (publickey).                          

or

                              1abort: Permission denied:                          

or (In instance you are working with mercury so y'all might encounter this mistake message)

                              aneremote: Permission denied (publickey).                2abort: no suitable response from remote hg!                          


How to prepare?

Before we get-go debugging the issue, let's first debug the issue to know the exact reason behind this mistake.

Run the following control from your terminal (put your correct repository proper name) -

                              1ssh -T your_bitbucket_repo@domain.com                2                          

The higher up command should return you with Username and in instance you did not see your username then yous need to Create SSH keys and add together to your BitBucket account.

Step 1 - Create your Public SSH Keys

Step two - Goto Your Account -> Manage Account -> SSH Keys

Footstep iii - Click on Add Key

Step 4 - Paste your key which you take generated in Step 1.

Stride 5 - Finally click on Add Primal

It should work subsequently calculation the SSH keys to your BitBucket account.

(Note - Here are some official links from bitbucket if you are interested more - click here)



3.ii Permission on your bitbucket directory

There could also be a possibility that yous do not have permission to access the BitBucket repository. Check with your bitbucket administrator with regards to your permission.

If information technology is the example of permission and then your bitbucket administrator could grant the permission.

1.1 Generate ssh-keygen on Windows 10

If yous are working on a windows machine and then you demand to install the OpenSSH.

Goto: Apps > Apps and Features > Manage Optional Features

Verify the list of the apps, if it already installed. If not then go at the top of the page and then select Add a Feature afterwords -

  • OpenSSH Customer : Locate OpenSSH Client, then click Install.
  • OpenSSH Server : Locate OpenSSH Server, and then click Install.


Install OpenSSH using PowerShell on Windows 10

If you like using Powershell and then first make sure OpenSSH features are bachelor to install -

Copy and run the following command

                              1Become-WindowsCapability -Online                |                ? Name -like                'OpenSSH*'                2                3                # This should return the following output:                4                5Name  : OpenSSH.Client~~~~0.0.1.0                6Country : NotPresent                7Name  : OpenSSH.Server~~~~0.0.1.0                eightState : NotPresent                          

After that install server and client features using the post-obit command -

                                                1                # Install the OpenSSH Client                                  2Add together-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0                                  3                                  iv                # Install the OpenSSH Server                                  fiveAdd together-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0                                  6                                  7                # Both of these should return the following output:                                  8                `                                  9Path          :                10Online        : True                11RestartNeeded : Imitation                          

1.2 Verify OpenSSH customer is installed
  1. Goto settings panel

  1. Click on Optional Features and and so wait for OpenSSH client, if yous tin can find the OpenSSH customer which means y'all have installed it correctly.

one.three Generate ssh keys on windows x
  1. Next we need to run the ssh-keygen and for that goto window'southward control prompt and open up it in administrator mode.

  1. In the control prompt type the following command
                                                1Generating public/private rsa key pair.                                  2Enter file in which to save the key                (C:\Users\rahulwagh/.ssh/id_rsa):                                  3Enter passphrase                (empty                for                no passphrase):                                  fourEnter same passphrase again:                                  fiveYour identification has been saved in C:\Users\rahulwagh/.ssh/id_rsa.                                  6Your public central has been saved in C:\Users\rahulwagh/.ssh/id_rsa.pub.                                  viiThe key fingerprint is:                                  8SHA256:Okq3w+SesCGLQVToSBQru8RdUZtT2EIIrzH5MQ67DWA rahulwagh@local                                  9The central's randomart prototype is:                10+---[RSA 3072]----+                11                |.ooo..+oo.                |                12                |                oo o..o+.                |                13                |                =                E                =                =                +.                |                14                |*oo X o .                |                15                |.+                =                o  Due south                |                xvi                |o.  + ..                |                17                |o ..+=+                |                18                |                o + *++                |                19                |. . o.+.                |                20+----[SHA256]-----+                21                          


i.four Where to observe the fundamental pair

The file will be generated at - C:\Users\rahulwagh.ssh\id_rsa

Proper noun of the file - id_rsa


4. How to fix(GitHub)-Back up for countersign authentication was removed. Delight use a personal access token instead

GitHub has recently announced their migration to apply token-based authentication which means yous can no longer use your username and password for GtiHub authentication. You lot need to create personal access token to continue use of your GitHub Repository.

Here is my private GitHub repository which I was trying to clone and prompted with the mistake message -

Before fixing the consequence lets endeavour to understand how do y'all clone your Git Repo - https:// or git@github.com

This issue is very much dependent on the way you clone your repository.

i. git@github.com:rahulwagh/jhooq.git - If you are using SSH style of cloning the repository so yous will not face issue related to personal access token. Because when you utilise SSH way of clonning then you should always create SSH Keys and copy public SSH cardinal to GitHub SSH and GPG keys

two. https://github.com/rahulwagh/jhooq.git - If you are using HTTPS style of cloning the Git Repository then yous volition be prompted with username, password and subsequently entering the username and countersign you will be thrown with error Support for countersign authentication was removed. Please apply a personal access token instead


How to fix the personal access token for GitHub Repository

  1. Login to your GitHub account from the spider web browser.
  2. Goto -> Profile Flick -> Setting

  1. After that you should look on the left navigation panel and there should be an option of Developer Settings

  1. Aftr that it will redirect y'all to the new page where you lot will find an pick Personal Access Token in the left navigation. You should click on information technology -

  1. Then adjacent on the right side of the screen you have an pick to Generate New Token -

  1. Enter the token name along with the scopes -

  1. Finally Generate Token
  2. Now Copy the generated Token

  1. Get dorsum to terminal and re-issue the Git Clone command and instead of countersign input the access token

Information technology should prepare your issue of - "Support for password authentication was removed. Please use a personal access token instead"

Advantages of using Personal Access Token

  1. Strong - The Personal Access Token are randomly generated cord which contains all possible combination of literal, number, upper example, lower instance and special symbol. Then it is really hard for creature force attack.
  2. Better Scoping - With personal access token y'all can command the access level at granular level.
  3. Multiple Personal Access Token - You can more and so one personal access token so that y'all do not have to share password with anyone else.
  4. Revocable - You lot tin easily revoke the admission to repository by deleting the personal admission token.

egbertwilen1995.blogspot.com

Source: https://jhooq.com/github-permission-denied-publickey/

0 Response to "Source Code Management Git Could Not Read From Remote Repository. Return Status 128"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel