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 -
- It is your private repo
- 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 -
- GitHub - How to fix git@github.com: Permission denied (public key)?
- GitLab - How to fix gitlab.com: permission denied (publickey) fatal: Could not read from remote repository
- BitBucket - Permission denied (public key), can't clone/clone to bitbucket
- 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
- Goto your GitHub Business relationship -> Settings
- Then expect for SSH and GPG keys under **Business relationship Settings -> SSH and GPG keys **
- After that click on New SSH Key . Assign some meaningful name to your primal
- 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
-
Copy the content of the cardinal
-
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
- Y'all do not need to supply you GitHub Username and password
- More secured
Drawback
- The process of generating SSH keys is little troublesome.
- 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 -
- GitHub repo URL with HTTPS (Ex - https://github.com/rahulwagh/example.git)
- Your GitHub Username
- 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
- You practise non need to generate SSH keys
- You do not demand to copy your SSH keys to GitHub accounts
- This approach tin can be used from whatsoever Laptop, Desktop. Y'all only need to provide your GitHub credentials with this arroyo.
Drawback
- 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 clickInstall. - OpenSSH Server : Locate
OpenSSH Server, and then clickInstall.
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
- Goto settings panel
- 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
- Next we need to run the
ssh-keygenand for that goto window'southward control prompt and open up it in administrator mode.
- 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
- Login to your GitHub account from the spider web browser.
- Goto -> Profile Flick -> Setting
- After that you should look on the left navigation panel and there should be an option of Developer Settings
- 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 -
- Then adjacent on the right side of the screen you have an pick to Generate New Token -
- Enter the token name along with the scopes -
- Finally Generate Token
- Now Copy the generated Token
- 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
- 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.
- Better Scoping - With personal access token y'all can command the access level at granular level.
- 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.
- Revocable - You lot tin easily revoke the admission to repository by deleting the personal admission token.
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