Ошибка клонирования репозитория

Если у вас возникли проблемы с клонированием репозитория, рассмотрите эти распространенные ошибки.

Ошибки клонирования HTTPS

При использовании HTTPS с GIT распространен ряд ошибок. Обычно они указывают на то, что у вас старая версия GIT или нет доступа к репозиторию.

Ниже приведен пример возможной ошибки HTTPS:

> error: The requested URL returned error: 401 while accessing
> https://github.com/USER/REPO.git/info/refs?service=git-receive-pack
> fatal: HTTP request failed
> Error: The requested URL returned error: 403 while accessing
> https://github.com/USER/REPO.git/info/refs
> fatal: HTTP request failed
> Error: https://github.com/USER/REPO.git/info/refs not found: did you run git
> update-server-info on the server?

Проверка версии GIT

Ограничений на минимальную версию GIT, требуемую для взаимодействия с GitHub, нет, но, по нашему опыту, версия 1.7.10 является удобной, стабильной версией, доступной на многих платформах. Последнюю версию всегда можно скачать на веб-сайте GIT.

Проверка правильности удаленного репозитория

Репозиторий, который вы пытаетесь получить, должен существовать в GitHub.com, а URL-адрес учитывает регистр.

Чтобы узнать URL-адрес локального репозитория, можно открыть командную строку и ввести git remote -v:

$ git remote -v
# View existing remotes
> origin  https://github.com/ghost/reactivecocoa.git (fetch)
> origin  https://github.com/ghost/reactivecocoa.git (push)

$ git remote set-url origin https://github.com/ghost/ReactiveCocoa.git
# Change the 'origin' remote's URL

$ git remote -v
# Verify new remote URL
> origin  https://github.com/ghost/ReactiveCocoa.git (fetch)
> origin  https://github.com/ghost/ReactiveCocoa.git (push)

Кроме того, можно изменить URL-адрес с помощью приложения GitHub Desktop.

Предоставление маркера доступа

Чтобы получить доступ к GitHub, необходимо пройти проверку подлинности с помощью personal access token вместо пароля. Дополнительные сведения см. в разделе Управление личными маркерами доступа.

Если вы обращаетесь к организации, которая использует единый вход SAML и используете personal access token (classic), вы также должны авторизовать personal access token для доступа к организации перед аутентификацией. Дополнительные сведения см. в разделах Сведения о проверке подлинности с помощью единого входа SAML и Авторизация личного токена доступа для использования с документами единого входа SAML.

Проверить свои разрешения

При появлении запроса на ввод имени пользователя и пароля используйте учетную запись с доступом к репозиторию.

Совет. Если вы не хотите вводить учетные данные при каждом взаимодействии с удаленным репозиторием, можно включить кэширование учетных данных. Если кэширование учетных данных уже используется, убедитесь в том, что на компьютере кэшированы правильные учетные данные. Неправильные или устаревшие учетные данные не позволят пройти проверку подлинности.

Использование SSH

Если вы ранее настроили ключи SSH, можно использовать URL-адрес клонирования SSH вместо HTTPS. Дополнительные сведения см. в разделе Сведения об удаленных репозиториях.

Ошибка: репозиторий не найден

Если вы видите эту ошибку при клонировании репозитория, это означает, что репозиторий не существует или у вас нет разрешения на доступ к нему. Существует несколько решений для этой ошибки в зависимости от причины.

Проверка правильности написания

Всегда есть вероятность опечатки. Кроме того, в именах репозиториев учитывается регистр символов. Если вы попытаетесь клонировать git@github.com:user/repo.git, но репозиторий на самом деле называется User/Repo, произойдет эта ошибка.

Чтобы избежать этой ошибки, при клонировании всегда копируйте URL-адрес клона со страницы репозитория, а затем вставляйте его. Дополнительные сведения см. в разделе Клонирование репозитория.

Сведения об обновлении удаленного репозитория см. в разделе Управление удаленными репозиториями.

Проверка разрешений

Если вы пытаетесь клонировать частный репозиторий, но не имеете разрешения на его просмотр, произойдет эта ошибка.

Убедитесь в том, что у вас есть один из следующих уровней доступа:

  • владелец репозитория;
  • участник совместной работы над репозиторием;
  • участник команды, которая имеет доступ к репозиторию (если репозиторий принадлежит организации).

Проверка доступа по протоколу SSH

В редких случаях может отсутствовать доступ к репозиторию по протоколу SSH из-за неправильной настройки.

Убедитесь в том, что используемый ключ SSH связан с личной учетной записью на GitHub. Это можно проверить, введя в командную строку следующую команду:

$ ssh -T git@github.com
> Hi USERNAME! You've successfully authenticated, but GitHub does not
> provide shell access.

Если репозиторий принадлежит организации и вы используете ключ SSH, созданный приложением OAuth, доступ к приложению может быть ограничен владельцем организации. Дополнительные сведения см. в разделе Сведения об ограничениях доступа к приложению OAuth.

Дополнительные сведения см. в разделе Добавление нового ключа SSH в учетную запись GitHub.

Проверка существования репозитория

Если все остальное не удается, убедитесь, что репозиторий действительно существует в GitHub.com!
Если вы пытаетесь выполнить отправку в несуществующий репозиторий, произойдет эта ошибка.

Ошибка: файл HEAD удаленного репозитория ссылается на несуществующую ветвь; не удалось выполнить извлечение

Эта ошибка возникает, если ветвь репозитория по умолчанию была удалена в GitHub.com.

Обнаружить эту ошибку легко: GIT предупредит вас при попытке клонировать репозиторий:

$ git clone https://github.com/USER/REPO.git
# Clone a repo
> Cloning into 'repo'...
> remote: Counting objects: 66179, done.
> remote: Compressing objects: 100% (15587/15587), done.
> remote: Total 66179 (delta 46985), reused 65596 (delta 46402)
> Receiving objects: 100% (66179/66179), 51.66 MiB | 667 KiB/s, done.
> Resolving deltas: 100% (46985/46985), done.
> warning: remote HEAD refers to nonexistent ref, unable to checkout.

Чтобы устранить эту ошибку, необходимо быть администратором репозитория в GitHub.com.
Вам потребуется изменить ветвь по умолчанию репозитория.

После этого можно получить список всех доступных ветвей из командной строки:

$ git branch -a
# Lists ALL the branches
>   remotes/origin/awesome
>   remotes/origin/more-work
>   remotes/origin/new-main

Затем можно просто переключиться на новую ветвь:

$ git checkout new-main
# Create and checkout a tracking branch
> Branch new-main set up to track remote branch new-main from origin.
> Switched to a new branch 'new-main'
title intro redirect_from versions topics

Troubleshooting cloning errors

If you’re having trouble cloning a repository, check these common errors.

/articles/error-the-requested-url-returned-error-403

/articles/error-the-requested-url-returned-error-401

/articles/error-did-you-run-git-update-server-info-on-the-server

/articles/error-the-requested-url-returned-error-403-while-accessing-https-github-com-user-repo-git-info-refs

/articles/https-cloning-errors

/github/creating-cloning-and-archiving-repositories/https-cloning-errors

/articles/error-repository-not-found

/github/creating-cloning-and-archiving-repositories/error-repository-not-found

/articles/error-remote-head-refers-to-nonexistent-ref-unable-to-checkout

/github/creating-cloning-and-archiving-repositories/error-remote-head-refers-to-nonexistent-ref-unable-to-checkout

fpt ghes ghae ghec

*

*

*

*

Repositories

HTTPS cloning errors

There are a few common errors when using HTTPS with Git. These errors usually indicate you have an old version of Git, or you don’t have access to the repository.

Here’s an example of an HTTPS error you might receive:

> error: The requested URL returned error: 401 while accessing
> https://{% data variables.command_line.codeblock %}/USER/REPO.git/info/refs?service=git-receive-pack
> fatal: HTTP request failed
> Error: The requested URL returned error: 403 while accessing
> https://{% data variables.command_line.codeblock %}/USER/REPO.git/info/refs
> fatal: HTTP request failed
> Error: https://{% data variables.command_line.codeblock %}/USER/REPO.git/info/refs not found: did you run git
> update-server-info on the server?

Check your Git version

There’s no minimum Git version necessary to interact with {% data variables.product.product_name %}, but we’ve found version 1.7.10 to be a comfortable stable version that’s available on many platforms. You can always download the latest version on the Git website.

Ensure the remote is correct

The repository you’re trying to fetch must exist on {% data variables.location.product_location %}, and the URL is case-sensitive.

You can find the URL of the local repository by opening the command line and
typing git remote -v:

$ git remote -v
# View existing remotes
> origin  https://github.com/ghost/reactivecocoa.git (fetch)
> origin  https://github.com/ghost/reactivecocoa.git (push)

$ git remote set-url origin https://github.com/ghost/ReactiveCocoa.git
# Change the 'origin' remote's URL

$ git remote -v
# Verify new remote URL
> origin  https://github.com/ghost/ReactiveCocoa.git (fetch)
> origin  https://github.com/ghost/ReactiveCocoa.git (push)

Alternatively, you can change the URL through our
{% data variables.product.prodname_desktop %} application.

Provide an access token

To access {% data variables.product.prodname_dotcom %}, you must authenticate with a {% data variables.product.pat_generic %} instead of your password. For more information, see «AUTOTITLE.»

{% data reusables.command_line.provide-an-access-token %}

Check your permissions

When prompted for a username and password, make sure you use an account that has access to the repository.

{% tip %}

Tip: If you don’t want to enter your credentials every time you interact with the remote repository, you can turn on credential caching. If you are already using credential caching, please make sure that your computer has the correct credentials cached. Incorrect or out of date credentials will cause authentication to fail.

{% endtip %}

Use SSH instead

If you’ve previously set up SSH keys, you can use the SSH clone URL instead of HTTPS. For more information, see «AUTOTITLE.»

Error: Repository not found

{% ifversion fpt or ghae or ghec %}If you see this error when cloning a repository, it means that the repository does not exist or you do not have permission to access it.{% else %}If you see this error when cloning a repository, it means that the repository does not exist, you do not have permission to access it, or {% data variables.location.product_location %} is in private mode.{% endif %} There are a few solutions to this error, depending on the cause.

Check your spelling

Typos happen, and repository names are case-sensitive. If you try to clone git@{% data variables.command_line.codeblock %}:user/repo.git, but the repository is really named User/Repo you will receive this error.

To avoid this error, when cloning, always copy and paste the clone URL from the repository’s page. For more information, see «AUTOTITLE.»

To update the remote on an existing repository, see «AUTOTITLE».

Checking your permissions

If you are trying to clone a private repository but do not have permission to view the repository, you will receive this error.

Make sure that you have access to the repository in one of these ways:

  • The owner of the repository
  • A collaborator on the repository
  • A member of a team that has access to the repository (if the repository belongs to an organization)

Check your SSH access

In rare circumstances, you may not have the proper SSH access to a repository.

You should ensure that the SSH key you are using is attached to your personal account on {% data variables.product.product_name %}. You can check this by typing
the following into the command line:

$ ssh -T git@{% data variables.command_line.codeblock %}
> Hi USERNAME! You've successfully authenticated, but GitHub does not
> provide shell access.

{% ifversion fpt or ghec %}
If the repository belongs to an organization and you’re using an SSH key generated by an OAuth App, OAuth App access may have been restricted by an organization owner. For more information, see «AUTOTITLE.»
{% endif %}

For more information, see Adding a new SSH key to your GitHub account.

{% ifversion ghes %}

Check if your instance is in private mode

If your site administrator has enabled private mode on your GitHub Enterprise instance, anonymous clones over git:// will be disabled. If you are unable to clone a repository, contact your site administrator.
{% endif %}

Check that the repository really exists

If all else fails, make sure that the repository really exists on {% data variables.location.product_location %}!
If you’re trying to push to a repository that doesn’t exist, you’ll get this error.

Error: Remote HEAD refers to nonexistent ref, unable to checkout

This error occurs if the default branch of a repository has been deleted on {% data variables.location.product_location %}.

Detecting this error is simple; Git will warn you when you try to clone the repository:

$ git clone https://{% data variables.command_line.codeblock %}/USER/REPO.git
# Clone a repo
> Cloning into 'repo'...
> remote: Counting objects: 66179, done.
> remote: Compressing objects: 100% (15587/15587), done.
> remote: Total 66179 (delta 46985), reused 65596 (delta 46402)
> Receiving objects: 100% (66179/66179), 51.66 MiB | 667 KiB/s, done.
> Resolving deltas: 100% (46985/46985), done.
> warning: remote HEAD refers to nonexistent ref, unable to checkout.

To fix the error, you’ll need to be an administrator of the repository on {% data variables.location.product_location %}.
You’ll want to change the default branch of the repository.

After that, you can get a list of all the available branches from the command line:

$ git branch -a
# Lists ALL the branches
>   remotes/origin/awesome
>   remotes/origin/more-work
>   remotes/origin/new-main

Then, you can just switch to your new branch:

$ git checkout new-main
# Create and checkout a tracking branch
> Branch new-main set up to track remote branch new-main from origin.
> Switched to a new branch 'new-main'

Ekaterina

Ekaterina

07.12.2020, 08:42

Александр, здравствуйте!
Подскажите, пожалуйста, мне не удается склонировать проект.
Постоянно выходит ошибка: No such file or directory.
Ключи SSH я сформировала, прописала на GitHub, сохранила.
Далее, при вводе команды: git@github.com: имя проекта
выходит сообщение: bash: git@github.com: имя проекта.git: No such file or directory
На всех возможных ресурсах ищу ответ, исправить не удается.
Как исправить ошибку?

Ekaterina

Ekaterina

07.12.2020, 09:16

Также, погуглила и по одной рекомендации, проверила соединение с GitHub через команду: ssh -T git@github.com
Выходит вот что: The authenticity of host ‘github.com (……)’ can’t be established.
RSA key fingerprint is SHA256: номер ключа.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Александр Мальцев

Александр Мальцев

06.10.2016, 12:59

1. Необходимо создать идентификационный ключ RSA (по умолчанию он помещается в файл id_rsa.pub):

ssh-keygen -t rsa

2. Открыть в браузере страницу _https://github.com/settings/ssh. Нажать в ней на кнопку New SSH key. В открывшейся форме ввести имя и ключ из файла id_rsa.pub.
3. Выполнить клонирования репозитория.

после этого
git clone https://github.com/r0-nook/R
выдаёт

Cloning into 'R'...
remote: Enumerating objects: 2047, done.
remote: Total 2047 (delta 0), reused 0 (delta 0), pack-reused 2047
Receiving objects: 100% (2047/2047), 592.90 MiB | 1.74 MiB/s, done.
Resolving deltas: 100% (322/322), done.
error: invalid path 'R0_tail/n8/R1_Q8. Перекидыши. Крыса-2./фея/Фея.md'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

после этого
git clone https://github.com/r0-nook/R ./
выдаёт

Cloning into '.'...
remote: Enumerating objects: 2047, done.
error: RPC failed; curl 56 OpenSSL SSL_read: Connection was reset, errno 10054
error: 6407 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

обсуждение проблемы здесь https://stackoverflow.com/questions/22041752/githu…

Наталкивает на мысль что проблема в правах доступа, если это так то мой вопрос.
Как дать это «разрешение»?

терминал я открываю пкм в директории и выбираю конему в выпадающем меню, вопрос про открытие с правами админа система не задаёт.

п.с. только поставил вин10 у меня один диск С и свобоных 142гб

Первый раз устанавливаю Git на 2008 R2.

Что было сделано:

  1. Установлен на сервере Git
  2. Установлен Bitvise SSH Server
  3. На сервере создан локальный пользователь test и добавлен в группу
    администраторов
  4. В настройках SSH сервера пользователю test разрешен доступ виндовому
    паролю
  5. Подключение с рабочих станций по SSH работает, проблем нет
  6. На сервере через Git Gui был создан репозиторий по пути
    e:Repositoriestest
  7. Далее с рабочей станции выполняю в git bash

    git clone
    ssh://test@server:/e/Repositories/test
    
  8. В ответ получаю

    fatal: does not appear to be git repository, fatal:
    Could not read from remote repository

2 дня читаю форумы, не понимаю в чем ошибка, права у пользователя test на эту папку есть.

Peter Olson's user avatar

Peter Olson

10.4k7 золотых знаков30 серебряных знаков53 бронзовых знака

задан 17 июл 2015 в 8:33

Alex Molskiy's user avatar

1

в другом ответе (и комментариях к нему) всплыл корень проблемы:

можете ли Вы клонировать проект в терминале так?

git clone ssh://test@server:/e/Repositories/test.git

В терминале Win ошибка — error: cannot spawn ssh: No such file or directory

вероятно, нет программы ssh ни в одном из каталогов, определённых в переменной окружения PATH.

Дух сообщества's user avatar

ответ дан 21 июл 2015 в 2:00

aleksandr barakin's user avatar

aleksandr barakinaleksandr barakin

67.7k208 золотых знаков76 серебряных знаков218 бронзовых знаков

можете ли Вы клонировать проект в терминале так?

git clone ssh://test@server:/e/Repositories/test.git

ответ дан 17 июл 2015 в 9:00

username's user avatar

usernameusername

1,2108 серебряных знаков26 бронзовых знаков

3

Понравилась статья? Поделить с друзьями:
  • Ошибка климата 22 ниссан патфайндер
  • Ошибка климата 1426 мерседес w220
  • Ошибка климата 1270 w220
  • Ошибка климата 1269 w220
  • Ошибка климата 1257 w220