I come across this error while uploading project to gitlab. I didn’t clone from git but instead upload project. For pushing your code to gitlab you have two ways either using ssh or https. If you use https you have to enter username and password of gitlab account. For pushing you code to git you can use following one.
Pushing to Git for the first time
>$ cd
>$ mkdir .ssh;cd .ssh
>$ ssh-keygen -o -t rsa -b 4096 -C "email@example.com"
The -C parameter is optional, it provides a comment at the end of your key to distinguish it from others if you have multiple.
This will create id_rsa (your private key) and id_rsa.pub (your public key). We pass our public key around and keep our private key — well, private. Gitlab’s User Settings is where you would then add your public key to your account, allowing us to finally push.
In your project location(Directory) use below command
git init
It Transform the current directory into a Git repository. This adds a .git subdirectory to the current directory and makes it possible to start recording revisions of the project.
Push Using https path
git push --set-upstream https://gitlab.com/Account_User_Name/Your_Project_Name.git master
Push Using ssh path
git push --set-upstream git@gitlab.com:Account_User_Name/Your_project_Name.git master
— set-upstream: tells git the path to origin. If Git has previously pushed on your current branch, it will remember where origin is
master: this is the name of the branch I want to push to when initializing
Много статей (в том числе и на Хабре) посвящено подключению к Git по SSH-ключам. Почти во всех из них используется один из двух способов: либо с помощью puttygen.exe, либо командами ssh-keygen или ssh-add.
Вчера на одном из компьютеров у меня не получилось сделать это для msysgit ни одним из описанных в интернете способов, и я потратил несколько часов на попытки настроить SSH-доступ, так ни чего и не добившись.
Как я решил эту проблему — под катом.
BitBucket всё время ругался на то, что ему требуется подключение с помощью ключа:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Мои попытки сгенерировать ключи, указать пути в переменных среды, привязать ключи к гиту были бесполезны. Либо гит ругался крякозябрами (в случае ssh-agent cmd.exe), либо просто игнорировал всё предложенное.
Решение оказалось куда удобнее и проще. Достаточно запустить в локальном репозитории GIT GUI Here, и в меню перейти в
Help -> Show SSH Key:
Скрины
Если вы столкнулись с такой проблемой, то скорее всего у вас там ни чего не будет:
Окно генерации SSH Key
Ну а дальше читать будут, скорее всего, только самые педантичные… Жмём Generate key, видим окно запроса пароля (два раза) для приватного ключа:
Запрос пароля
И видим сгенерировавшийся публичный ключ:
Публичный ключ
Копируем его, и добавляем вэб-морду ГИТа (в моём случае это BitBucket; ключи там можно добавить в двух местах — в настройках аккаунта и в настройках проекта, нам первый вариант, ибо второй — для деплоя проекта) [Аккаунт] — Управление аккаунтом — SSH-ключи — Добавить ключ:
Добавление ключа в BitBucket
Ну, а дальше — просто делаем что нужно — или пуш, или клон (предполагается, что git remote add вы уже сделали сами). Git спросит, можно ли добавить хост к доверенным, и запросит passphrase (пароль приватного ключа). Всё, можно работать.
Удачных разработок!
PS: Большое спасибо за наводку на решение моему коллеге Ивану!
Я получаю эту ошибку —
D:ProjectswampwwwREPO [master]> git pull origin master
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
выход git remote-v
D:ProjectswampwwwREPO [master]> git remote -v
origin git@github.com:username/repo.git (fetch)
origin git@github.com:username/repo.git (push)
последнее сообщение от ssh-Tv git@github.com команда —
Hi [My Username]! You've successfully authenticated, but GitHub does not provide shell access.
как я могу решить это?
8 ответов
Я спросил в обсуждении:
тут
ssh -T git@github.com
ouput то же имя пользователя (in Hi [My Username]!
) как и в том, который используется для url ssh вашего РЕПО (git@github.com:username/repo.git
)?Извините, что он не показывает то же имя
это означает, что каким-то образом учетные данные изменились.
одним из решений было бы, по крайней мере, скопировать %HOME%.sshid_rsa.pub
на раздел ключей SSH правой учетной записи GitHub
в ОП добавляет:
Я работаю над частным РЕПО. Так в git@github.com:username/repo.git,
я ответил:
если вы смогли клонировать / нажимать на это РЕПО, чье имя пользователя не является вашей собственной учетной записью GitHub, это должно быть потому, что у вас был предыдущий открытый ssh-ключ, добавленный владельцем РЕПО в качестве участника этого РЕПО.
что дальше, чтобы попросить того же владельца РЕПО добавить ваш текущий публичный ssh ключ
%HOME%.sshid_rsa.pub
в список вкладчиков РЕПО.
Поэтому проверьте с владельцем, что вы (то есть ваш открытый ssh-ключ) объявлены как участник.
измените url ssh на url http для вашего удаленного «происхождения», используйте:
> git remote set-url origin https://github.com/<user_name>/<repo_name>.git
он запросит ваш пароль GitHub на git push.
иногда это случается со мной из-за сетевых проблем. Я не понимаю проблему полностью, но переключение на другую подсеть или использование VPN решает ее
эта ошибка произошла и со мной, так как исходный создатель репозитория покинул компанию, что означало, что их учетная запись была удалена из команды github.
git remote set-url origin https://github.com/<user_name>/<repo_name>.git
и затем
git pull origin develop
или любая команда git, которую вы хотите выполнить, должна запросить у Вас логин и продолжить как обычно.
у меня была эта проблема и пробовал много вещей, но все равно не работал. В конце концов я решил создать еще один SSH KEY
и-бум — она работала. Следуйте этой статье github чтобы направлять вас о том, как создать свой SSH KEY.
наконец, не забудьте добавить его в настройки github. Нажмите здесь для руководства о том, как добавить SSH KEY
к вашей учетной записи github.
эта ошибка может быть из-за отсутствия SSH-ключа на вашем локальном компьютере. Проверьте ключ SSH локально:
$ cat ~/.ssh/id_rsa.pub
Если выше команда не дает никаких выходных данных, используйте ниже команду для создания ssh-ключа (Linux / Mac):
$ ssh-keygen
Теперь снова запустите cat ~/.ssh / id_rsa.паб это ваш ключ SSH. Скопируйте и добавьте этот ключ в свои SSH-ключи в Git.
В gitlab / bitbucket перейдите в
profile settings -> SSH Keys -> add Key
и добавить ключ
I come across this error while uploading project to gitlab. I didn’t clone from git but instead upload project. For pushing your code to gitlab you have two ways either using ssh or https. If you use https you have to enter username and password of gitlab account. For pushing you code to git you can use following one.
Pushing to Git for the first time
>$ cd
>$ mkdir .ssh;cd .ssh
>$ ssh-keygen -o -t rsa -b 4096 -C "email@example.com"
The -C parameter is optional, it provides a comment at the end of your key to distinguish it from others if you have multiple.
This will create id_rsa (your private key) and id_rsa.pub (your public key). We pass our public key around and keep our private key — well, private. Gitlab’s User Settings is where you would then add your public key to your account, allowing us to finally push.
In your project location(Directory) use below command
git init
It Transform the current directory into a Git repository. This adds a .git subdirectory to the current directory and makes it possible to start recording revisions of the project.
Push Using https path
git push --set-upstream https://gitlab.com/Account_User_Name/Your_Project_Name.git master
Push Using ssh path
git push --set-upstream git@gitlab.com:Account_User_Name/Your_project_Name.git master
— set-upstream: tells git the path to origin. If Git has previously pushed on your current branch, it will remember where origin is
master: this is the name of the branch I want to push to when initializing
Много статей (в том числе и на Хабре) посвящено подключению к Git по SSH-ключам. Почти во всех из них используется один из двух способов: либо с помощью puttygen.exe, либо командами ssh-keygen или ssh-add.
Вчера на одном из компьютеров у меня не получилось сделать это для msysgit ни одним из описанных в интернете способов, и я потратил несколько часов на попытки настроить SSH-доступ, так ни чего и не добившись.
Как я решил эту проблему — под катом.
BitBucket всё время ругался на то, что ему требуется подключение с помощью ключа:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Мои попытки сгенерировать ключи, указать пути в переменных среды, привязать ключи к гиту были бесполезны. Либо гит ругался крякозябрами (в случае ssh-agent cmd.exe), либо просто игнорировал всё предложенное.
Решение оказалось куда удобнее и проще. Достаточно запустить в локальном репозитории GIT GUI Here, и в меню перейти в
Help -> Show SSH Key:
Скрины
Если вы столкнулись с такой проблемой, то скорее всего у вас там ни чего не будет:
Окно генерации SSH Key
Ну а дальше читать будут, скорее всего, только самые педантичные… Жмём Generate key, видим окно запроса пароля (два раза) для приватного ключа:
Запрос пароля
И видим сгенерировавшийся публичный ключ:
Публичный ключ
Копируем его, и добавляем вэб-морду ГИТа (в моём случае это BitBucket; ключи там можно добавить в двух местах — в настройках аккаунта и в настройках проекта, нам первый вариант, ибо второй — для деплоя проекта) [Аккаунт] — Управление аккаунтом — SSH-ключи — Добавить ключ:
Добавление ключа в BitBucket
Ну, а дальше — просто делаем что нужно — или пуш, или клон (предполагается, что git remote add вы уже сделали сами). Git спросит, можно ли добавить хост к доверенным, и запросит passphrase (пароль приватного ключа). Всё, можно работать.
Удачных разработок!
PS: Большое спасибо за наводку на решение моему коллеге Ивану!
stage | group | info | type |
---|---|---|---|
Create |
Source Code |
To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments |
howto |
Troubleshooting Git (FREE)
Sometimes things don’t work the way they should or as you might expect when
you’re using Git. Here are some tips on troubleshooting and resolving issues
with Git.
Broken pipe errors on git push
‘Broken pipe’ errors can occur when attempting to push to a remote repository.
When pushing you usually see:
Write failed: Broken pipe
fatal: The remote end hung up unexpectedly
To fix this issue, here are some possible solutions.
Increase the POST buffer size in Git
If you’re using Git over HTTP instead of SSH, you can try increasing the POST buffer size in Git
configuration.
Example of an error during a clone:
fatal: pack has bad object at offset XXXXXXXXX: inflate returned -5
Open a terminal and enter:
git config http.postBuffer 52428800
The value is specified in bytes, so in the above case the buffer size has been
set to 50 MB. The default is 1 MB.
RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)
This problem may be caused by a slow internet connection. If you use Git over HTTP
instead of SSH, try one of these fixes:
- Increase the POST buffer size in the Git configuration with
git config http.postBuffer 52428800
. - Switch to the
HTTP/1.1
protocol withgit config http.version HTTP/1.1
.
If neither approach fixes the error, you may need a different internet service provider.
Check your SSH configuration
If pushing over SSH, first check your SSH configuration as ‘Broken pipe’
errors can sometimes be caused by underlying issues with SSH (such as
authentication). Make sure that SSH is correctly configured by following the
instructions in the SSH troubleshooting documentation.
If you’re a GitLab administrator with server access, you can also prevent
session timeouts by configuring SSH keep-alive
on the client or the server.
NOTE:
Configuring both the client and the server is unnecessary.
To configure SSH on the client side:
-
On UNIX, edit
~/.ssh/config
(create the file if it doesn’t exist) and
add or edit:Host your-gitlab-instance-url.com ServerAliveInterval 60 ServerAliveCountMax 5
-
On Windows, if you are using PuTTY, go to your session properties, then
navigate to «Connection» and under «Sending of null packets to keep
session active», setSeconds between keepalives (0 to turn off)
to60
.
To configure SSH on the server side, edit /etc/ssh/sshd_config
and add:
ClientAliveInterval 60
ClientAliveCountMax 5
Running a git repack
If ‘pack-objects’ type errors are also being displayed, you can try to
run a git repack
before attempting to push to the remote repository again:
Upgrade your Git client
In case you’re running an older version of Git (< 2.9), consider upgrading
to >= 2.9 (see Broken pipe when pushing to Git repository).
ssh_exchange_identification
error
Users may experience the following error when attempting to push or pull
using Git over SSH:
Please make sure you have the correct access rights
and the repository exists.
...
ssh_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.
or
ssh_exchange_identification: Connection closed by remote host
fatal: The remote end hung up unexpectedly
or
kex_exchange_identification: Connection closed by remote host
Connection closed by x.x.x.x port 22
This error usually indicates that SSH daemon’s MaxStartups
value is throttling
SSH connections. This setting specifies the maximum number of concurrent, unauthenticated
connections to the SSH daemon. This affects users with proper authentication
credentials (SSH keys) because every connection is ‘unauthenticated’ in the
beginning. The default value is 10
.
Increase MaxStartups
on the GitLab server
by adding or modifying the value in /etc/ssh/sshd_config
:
100:30:200
means up to 100 SSH sessions are allowed without restriction,
after which 30% of connections are dropped until reaching an absolute maximum of 200.
After you modify the value of MaxStartups
, check for any errors in the configuration.
sudo sshd -t -f /etc/ssh/sshd_config
If the configuration check runs without errors, it should be safe to restart the
SSH daemon for the change to take effect.
# Debian/Ubuntu sudo systemctl restart ssh # CentOS/RHEL sudo service sshd restart
Timeout during git push
/ git pull
If pulling/pushing from/to your repository ends up taking more than 50 seconds,
a timeout is issued. It contains a log of the number of operations performed
and their respective timings, like the example below:
remote: Running checks for branch: master
remote: Scanning for LFS objects... (153ms)
remote: Calculating new repository size... (cancelled after 729ms)
This could be used to further investigate what operation is performing poorly
and provide GitLab with more information on how to improve the service.
git clone
over HTTP fails with transfer closed with outstanding read data remaining
error
Sometimes, when cloning old or large repositories, the following error is thrown:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
This is a common problem with Git itself, due to its inability to handle large files or large quantities of files.
Git LFS was created to work around this problem; however, even it has limitations. It’s usually due to one of these reasons:
- The number of files in the repository.
- The number of revisions in the history.
- The existence of large files in the repository.
The root causes vary, so multiple potential solutions exist, and you may need to
apply more than one:
-
If this error occurs when cloning a large repository, you can
decrease the cloning depth
to a value of1
. For example: -
You can increase the
http.postBuffer
value in your local Git configuration from the default 1 MB value to a value greater
than the repository size. For example, ifgit clone
fails when cloning a 500 MB
repository, you should sethttp.postBuffer
to524288000
:# Set the http.postBuffer size, in bytes git config http.postBuffer 524288000
-
You can increase the
http.postBuffer
on the server side:-
Modify the GitLab instance’s
gitlab.rb
file:gitaly['gitconfig'] = [ # Set the http.postBuffer size, in bytes {key: "http.postBuffer", value: "524288000"}, ]
-
After applying this change, apply the configuration change:
sudo gitlab-ctl reconfigure
-
For example, if a repository has a very long history and no large files, changing
the depth should fix the problem. However, if a repository has very large files,
even a depth of 1 may be too large, thus requiring the postBuffer
change.
If you increase your local postBuffer
but the NGINX value on the backend is still
too small, the error persists.
Modifying the server is not always an option, and introduces more potential risk.
Attempt local changes first.
Password expired error on Git fetch via SSH for LDAP user
If git fetch
returns this HTTP 403 Forbidden
error on a self-managed instance of
GitLab, the password expiration date (users.password_expires_at
) for this user in the
GitLab database is a date in the past:
Your password expired. Please access GitLab from a web browser to update your password.
Requests made with a SSO account and where password_expires_at
is not null
return this error:
"403 Forbidden - Your password expired. Please access GitLab from a web browser to update your password."
To resolve this issue, you can update the password expiration by either:
-
Using the
gitlab-rails console
:gitlab-rails console user.update!(password_expires_at: nil)
-
Using
gitlab-psql
:# gitlab-psql UPDATE users SET password_expires_at = null WHERE username='<USERNAME>';
The bug was reported in this issue.
Error on Git fetch: «HTTP Basic: Access Denied»
If you receive an HTTP Basic: Access denied
error when using Git over HTTP(S),
refer to the two-factor authentication troubleshooting guide.
GitHub is a code hosting platform for version control and collaboration allowing you to work together with other developers from all over the world building software. Let’s say you are starting on this journey and have a personal repository you are trying to perform a git clone or a git push but end up receiving obscure permission denied publickey error. Worry no more, this article will share how to fix this error once and for all.
The Error Message
For instance, when you are running a git clone command, you are seeing an error messaging that goes something like below.
Cloning into '<YOUR FOLDER>'... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
If you are cloning a git repository using Visual Studio, you might be seeing this error message below which is very obscure and at least to me, not very helpful.
Git failed with a fatal error. Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
If you are seeing any of the above error messages or other messages that relate to could not read from a remote repository, or permission denied (publickey) then read along to learn how to fix this.
Fixing Git Permission Denied PublicKey
After trying many different possible solutions such as re-installing Github desktop, deleting the Visual Studio git folder, and many other solutions that worked for others online, but not for me, the following is the only solution that fixed this issue for me.
Install Open SSH Client
The first step to solve this issue is to generate an SSH key pair that will be later loaded to your GitHub account. On windows, this is very easy to do with the Open-SSH client. To install it head on to your windows settings optional features.
Then install the OpenSSH Client that you see below.
Generate SSH Key Pair
With the OpenSSH Client install you can now use it to generate an SSH Key Pair. Open command prompt as an administrator and type the following:
ssh-keygen
To keep it very simple, just hit ENTER for all that you are prompted. When finished, you should see something like below. I have obscured a few of the items below.
You should also notice in the message where the keys got generated. This location will be used in the following step.
Copy SSH Key To GitHub
To get the key, you need to navigate to the folder where the keys got generated within the command prompt. Once there, type the following command, assuming id_rsa.pub is the filename and that you are using windows, for Linux it will be the cat command instead.
type id_rsa.pub
Now head on to your GitHub account into the settings.
Click where you see New SSH Key and copy the whole string that starts with ssh-rsa into here with an adequate name. Once you do this, git clone or git push will begin to work as expected!
Conclusion
I hope this article has helped you fix this permission denied publickey error and that you are finally able to clone a git repository or begin pushing code changes to one of them.
When you try to clone private repositories for the first time from an account, you may get following error.
Permission denied (publickey). Permission denied (publickey) fatal : Could not read from remote repository Please make sure you have the correct access rights and the repository exists.
This article helps you on fixing this issue. The root cause here is that the remote repository don’t trust you. In order to gain access to the repo, you have to create an SSH key and register that key in your git repository.
Steps to add SSH key in Gitlab
-
- Run CMD/Powershell/Terminal with administrative (sudo) privilege. (In windows run cmd as administrator. In linux execute ‘sudo su’ to get root privilege).
- Type ssh-keygen.
You will see the following. Here you will be asked for the location where the SSH key will be saved. Press enter to accept default or enter your custom location.Generating public/private rsa key pair. Enter file in which to save the key (C:UsersyourUsername/.ssh/id_rsa):
- Git will ask you to save the key to the specific directory.You will be asked for a password. Make sure you remember it since it will be needed for cloning.
Enter passphrase (empty for no passphrase):
- The public key will be created to the specific directory.
- Now go to the directory you have specified in Step 2 and open
.ssh
folder. - You’ll see a file
id_rsa.pub
. Open it on notepad. Copy all text from it. - Go to https://gitlab.com/profile/keys
Here you can see all the SSH keys specified so far. Paste the copied key.
- Now click on the “Title” below. It will automatically get filled based on the value taken from the SHA Key.
- Then click “Add key” and that’s it. You have successfully configured SSH.
- Now try cloning again. Git will ask for a password. Give the password you have given in Step 2.
And that’s all. Now you will be able to access the repo without any issues.
Stuck with permission denied in publickey ssh github? We can help you.
As part of our Server Management Services, we assist our customers with several github queries.
Today, let us see how our techs proceed to resolve it.
Permission denied in publickey ssh github
Typical error might look as shown below:
username@github.com: Permission denied (public key).
fatal: Could not read from remote repository.
It means GitHub is rejecting your connection because it is your private repo.
GitHub does not trust your computer because it does not have the public key of your computer.
Today, let us see the steps followed by our Support Techs to resolve it.
Please make sure you have the correct access rights and the repository exists.
Step 1:
Firstly, create SSH key pair
One of the easiest ways for you to generate a key pair is by running ssh-keygen utility.
Open the command prompt and type in the following
ssh-keygen
To keep the ssh-keygen simple, do not enter any key name or passphrase.
Step 2:
Adding SSH key to your GitHub account
1. Firstly, goto your GitHub Account -> Settings
2. Then, look for SSH and GPG keys under **Account Settings -> SSH and GPG keys **
3. After that click on New SSH Key. Assign some meaningful name to your key
4. To get the key goto to your command prompt and switch directory path
5. Then, run the following command
cat id_rsa.pub
6. Then, copy the content of the key
7. Finally, aste the key inside your GitHub account
[Stuck in between? We’d be glad to assist you]
Conclusion
In short, today we saw how our Support Techs assist in resolving
Stuck with permission denied in publickey ssh github? We can help you.
As part of our Server Management Services, we assist our customers with several github queries.
Today, let us see how our techs proceed to resolve it.
Permission denied in publickey ssh github
Typical error might look as shown below:
username@github.com: Permission denied (public key).
fatal: Could not read from remote repository.
It means GitHub is rejecting your connection because it is your private repo.
GitHub does not trust your computer because it does not have the public key of your computer.
Today, let us see the steps followed by our Support Techs to resolve it.
Please make sure you have the correct access rights and the repository exists.
Step 1:
Firstly, create SSH key pair
One of the easiest ways for you to generate a key pair is by running ssh-keygen utility.
Open the command prompt and type in the following
ssh-keygen
To keep the ssh-keygen simple, do not enter any key name or passphrase.
Step 2:
Adding SSH key to your GitHub account
1. Firstly, goto your GitHub Account -> Settings
2. Then, look for SSH and GPG keys under **Account Settings -> SSH and GPG keys **
3. After that click on New SSH Key. Assign some meaningful name to your key
4. To get the key goto to your command prompt and switch directory path
5. Then, run the following command
cat id_rsa.pub
6. Then, copy the content of the key
7. Finally, aste the key inside your GitHub account
[Stuck in between? We’d be glad to assist you]
Conclusion
In short, today we saw how our Support Techs assist in resolving
Stuck with permission denied in publickey ssh github? We can help you.
As part of our Server Management Services, we assist our customers with several github queries.
Today, let us see how our techs proceed to resolve it.
Permission denied in publickey ssh github
Typical error might look as shown below:
username@github.com: Permission denied (public key).
fatal: Could not read from remote repository.
It means GitHub is rejecting your connection because it is your private repo.
GitHub does not trust your computer because it does not have the public key of your computer.
Today, let us see the steps followed by our Support Techs to resolve it.
Please make sure you have the correct access rights and the repository exists.
Step 1:
Firstly, create SSH key pair
One of the easiest ways for you to generate a key pair is by running ssh-keygen utility.
Open the command prompt and type in the following:
ssh-keygen
To keep the ssh-keygen simple, do not enter any key name or passphrase.
Step 2:
Adding SSH key to your GitHub account
1. Firstly, goto your GitHub Account -> Settings
2. Then, look for SSH and GPG keys under **Account Settings -> SSH and GPG keys **
3. After that click on New SSH Key. Assign some meaningful name to your key
4. To get the key goto to your command prompt and switch directory path
5. Then, run the following command
cat id_rsa.pub
6. Then, copy the content of the key
7. Finally, aste the key inside your GitHub account
[Stuck in between? We’d be glad to assist you]
Conclusion
In short, today we saw how our Support Techs assist in resolving permission denied in publickey ssh github.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Comments
I have this error :
root@u12-49330:/data# git clonegit@github.com:jakubroztocil/cloudtunes.git
git: ‘clonegit@github.com:jakubroztocil/cloudtunes.git’ is not a git command. See ‘git —help’.
root@u12-49330:/data# git clone git@github.com:jakubroztocil/cloudtunes.git
Cloning into ‘cloudtunes’…
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
your github is still good?
Just copy your /root/.ssh/id_rsa.pub content as new github SSH key (https://github.com/settings/ssh).
If you does’t have id_rsa.pub, just create it with command ssh-keygen -t rsa
akshay2408 and teamhomelogic reacted with thumbs down emoji
penguinbing, Levi-kun, and Inspritionzzz reacted with laugh emoji
pals-ric, wesandradealves, stuckiest, mangguoaidami, Levi-kun, CalotaMihai, EdgarKoterle, tomwarrens, Beno951, Inspritionzzz, and harrythedev reacted with confused emoji
evgps, goDeni, icetaste, mj11rock, DroidPulkit, Papaass, diegosoriarios, warmwhisky, penguinbing, aroraakshit, and 6 more reacted with heart emoji
The instructions have been updated to clone over HTTPS. This should work with no issues:
$ git clone https://github.com/jakubroztocil/cloudtunes.git
vidhandosi, olegario96, frederikvho, and marcelsan reacted with thumbs down emoji
gkkai, Shiangmu, icetaste, j-planet, anatoliykant, marobo, aminkhademian, ojasjoshi, aliakseimahdzich, mcd50, and 4 more reacted with laugh emoji
sulthonzh, aminkhademian, vieckys, adelacvg, akshayi1, CarringtonCreative, MuffinCrow, and liutauras reacted with hooray emoji
Akshay-N-Shaju, SergeyNekrasoff, pals-ric, AhmadIbrahiim, youngfuture, prateektater, gon93, mangguoaidami, connielion, and frederikvho reacted with confused emoji
ricosmall, bexfinken, cynorfleet, icetaste, j-planet, prozb, xiaoyuxie-vico, BumbuKhan, MauricioLimaJR, aminkhademian, and 11 more reacted with heart emoji
Thanks that saved my night. Cloning over HTTPS solved my issue
JamesMarino, BumbuKhan, jungleiOS, and aminkhademian reacted with hooray emoji
BohdanLiango, Denis4yk, nemo9282, frederikvho, khailda, and jjercx reacted with confused emoji
BumbuKhan, aminkhademian, 1abdulaziz, and EnriqueSala reacted with heart emoji
I keep getting the same error even after cloning over https. Any idea why ?
hi
I have the similar error
when i run the puppet .
#############################
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
############################
i have my keys on my vm and my git is using the same key
please help me out
Thanks in ADVANCE
You’ll get this error on windows even if you have puttygen’d a ppk from your github_rsa key and added the ppk in peagent… until you visit github.com in putty. A good reason not to use windows, I suppose.
- eval
ssh-agent
- ssh-add ~/.ssh/your ssh key
- enter you ssh key pwd
- run any git command you want
dantemarchi, hailuhr, dtoubelis, karanvalecha, shaymLP, EpicIvo, phillipadamson, CavalcanteLeo, Fellipe26, and cromat reacted with hooray emoji
1 删除.ssh 下面的known_hosts 文件
2 删除github上的密钥,并重新生成和添加密钥
3 设置.ssh
4 还是不成功,就是你家的网络问题。 建议换一个网络。 并且github是不需要翻墙的。
pmilic021, 66Antigravity, beac0n, evanchen2914, 1abdulaziz, vincent-qin, aditsanghvi94, vishwakt, elcharles1, jcastrov, and 20 more reacted with confused emoji
BTW, the workaround suggested by @SadieYuCN works! You can also kill the ssh-agent after doing git pull
just once and everything returns back to normal.
Can anyone please solve my problem…. I am getting following error while cloning from github..
aadarsh@aadarsh-OptiPlex-9020:~/Desktop$ git clone git@github.com:p4lang/behavioral-model.git bmv2
Cloning into ‘bmv2’…
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I solved that using the answer from here:
first:
$ eval "$(ssh-agent -s)"
next:
$ ssh-add
[When I type this command below]:
git clone git@psr.pku.edu.cn:kjlee/bear.git
[Then, here are the output]
正克隆到 ‘bear’…
ssh: connect to host psr.pku.edu.cn port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have ssh key done.
I spent 3 hours and work around i did not find a solution the remote repo already exist i wonder why?
access rights denied
The instructions have been updated to clone over HTTPS. This should work with no issues:
$ git clone https://github.com/jakubroztocil/cloudtunes.git
Yo I am so glad I found this. Been trying to do school project and youtube aint helping. Thanks man!
had this problem on a mac and I discovered that simply by accessing the repository once from github desktop allows me to clone from the command line later
In windows 10 I used CWD in admin mode , as git bash didn’t said this same error over and over. But first I tried the ssh agent in the comment above.
Repository owner
locked as off-topic and limited conversation to collaborators
Dec 18, 2018
Git
Рекомендация: подборка платных и бесплатных курсов Git — https://katalog-kursov.ru/
Много статей (в том числе и на Хабре) посвящено подключению к Git по SSH-ключам. Почти во всех из них используется один из двух способов: либо с помощью puttygen.exe, либо командами ssh-keygen или ssh-add.
Вчера на одном из компьютеров у меня не получилось сделать это для msysgit ни одним из описанных в интернете способов, и я потратил несколько часов на попытки настроить SSH-доступ, так ни чего и не добившись.
Как я решил эту проблему — под катом.
BitBucket всё время ругался на то, что ему требуется подключение с помощью ключа:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Мои попытки сгенерировать ключи, указать пути в переменных среды, привязать ключи к гиту были бесполезны. Либо гит ругался крякозябрами (в случае ssh-agent cmd.exe), либо просто игнорировал всё предложенное.
Решение оказалось куда удобнее и проще. Достаточно запустить в локальном репозитории GIT GUI Here, и в меню перейти в
Help -> Show SSH Key:
Скрины
Если вы столкнулись с такой проблемой, то скорее всего у вас там ни чего не будет:
Окно генерации SSH Key
Ну а дальше читать будут, скорее всего, только самые педантичные… Жмём Generate key, видим окно запроса пароля (два раза) для приватного ключа:
Запрос пароля
И видим сгенерировавшийся публичный ключ:
Публичный ключ
Копируем его, и добавляем вэб-морду ГИТа (в моём случае это BitBucket; ключи там можно добавить в двух местах — в настройках аккаунта и в настройках проекта, нам первый вариант, ибо второй — для деплоя проекта) [Аккаунт] — Управление аккаунтом — SSH-ключи — Добавить ключ:
Добавление ключа в BitBucket
Ну, а дальше — просто делаем что нужно — или пуш, или клон (предполагается, что git remote add вы уже сделали сами). Git спросит, можно ли добавить хост к доверенным, и запросит passphrase (пароль приватного ключа). Всё, можно работать.
Удачных разработок!
PS: Большое спасибо за наводку на решение моему коллеге Ивану!
GitHub is a code hosting platform for version control and collaboration allowing you to work together with other developers from all over the world building software. Let’s say you are starting on this journey and have a personal repository you are trying to perform a git clone or a git push but end up receiving obscure permission denied publickey error. Worry no more, this article will share how to fix this error once and for all.
The Error Message
For instance, when you are running a git clone command, you are seeing an error messaging that goes something like below.
Cloning into '<YOUR FOLDER>'... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
If you are cloning a git repository using Visual Studio, you might be seeing this error message below which is very obscure and at least to me, not very helpful.
Git failed with a fatal error. Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
If you are seeing any of the above error messages or other messages that relate to could not read from a remote repository, or permission denied (publickey) then read along to learn how to fix this.
Fixing Git Permission Denied PublicKey
After trying many different possible solutions such as re-installing Github desktop, deleting the Visual Studio git folder, and many other solutions that worked for others online, but not for me, the following is the only solution that fixed this issue for me.
Install Open SSH Client
The first step to solve this issue is to generate an SSH key pair that will be later loaded to your GitHub account. On windows, this is very easy to do with the Open-SSH client. To install it head on to your windows settings optional features.
Then install the OpenSSH Client that you see below.
Generate SSH Key Pair
With the OpenSSH Client install you can now use it to generate an SSH Key Pair. Open command prompt as an administrator and type the following:
ssh-keygen
To keep it very simple, just hit ENTER for all that you are prompted. When finished, you should see something like below. I have obscured a few of the items below.
You should also notice in the message where the keys got generated. This location will be used in the following step.
Copy SSH Key To GitHub
To get the key, you need to navigate to the folder where the keys got generated within the command prompt. Once there, type the following command, assuming id_rsa.pub is the filename and that you are using windows, for Linux it will be the cat command instead.
type id_rsa.pub
Now head on to your GitHub account into the settings.
Click where you see New SSH Key and copy the whole string that starts with ssh-rsa into here with an adequate name. Once you do this, git clone or git push will begin to work as expected!
Conclusion
I hope this article has helped you fix this permission denied publickey error and that you are finally able to clone a git repository or begin pushing code changes to one of them.