Если у вас возникли проблемы с клонированием репозитория, рассмотрите эти распространенные ошибки.
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://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?
Check your Git version
There’s no minimum Git version necessary to interact with GitHub, 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 GitHub.com, 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
GitHub Desktop application.
Provide an access token
To access GitHub, you must authenticate with a personal access token instead of your password. For more information, see «Managing your personal access tokens.»
If you are accessing an organization that uses SAML SSO and you are using a personal access token (classic), you must also authorize your personal access token to access the organization before you authenticate. For more information, see «About authentication with SAML single sign-on» and «Authorizing a personal access token for use with SAML single sign-on.»
Check your permissions
When prompted for a username and password, make sure you use an account that has access to the repository.
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.
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 «About remote repositories.»
Error: Repository not found
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. 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@github.com: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 «Cloning a repository.»
To update the remote on an existing repository, see «Managing remote repositories».
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 GitHub. You can check this by typing
the following into the command line:
$ ssh -T git@github.com
> Hi USERNAME! You've successfully authenticated, but GitHub does not
> provide shell access.
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 «About OAuth app access restrictions.»
For more information, see Adding a new SSH key to your GitHub account.
Check that the repository really exists
If all else fails, make sure that the repository really exists on GitHub.com!
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 GitHub.com.
Detecting this error is simple; Git will warn you when you try to clone the repository:
$ 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.
To fix the error, you’ll need to be an administrator of the repository on GitHub.com.
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'
I just installed git for windows and tried to clone glew’s repo like this
$ git clone https://github.com/nigels-com/glew.git
But I got the following error
Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': SSL certificate problem: self signed certificate
I’ve seen people running into this problem and some possible workarounds.
First try
$ git -c http.sslVerify=false clone https://github.com/nigels-com/glew.git
Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': Empty reply from server
Second try
$ git config --global http.sslVerify false
$ git clone https://github.com/nigels-com/glew.git
Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': Empty reply from server
Then I checked for http.sslcainfo
entry in the config files
$ git config --system --list
credential.helper=manager
$ git config --global --list
https.proxy=<proxy-address>
http.sslverify=false
System and global config files does not have that entry. So I tried the following which I don’t know what file is reading and try to unset it.
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
http.sslverify=false
$ git config --unset http.sslcainfo
fatal: not in a git directory
Tried with global and system
$ git config --global --unset http.sslcainfo
$ git clone https://github.com/nigels-com/glew.git
Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': SSL certificate problem: self signed certificate
$ git config --system --unset http.sslcainfo
error: could not lock config file C:\Program Files\Git\mingw64/etc/gitconfig: Permission denied
error: could not lock config file C:\Program Files\Git\mingw64/etc/gitconfig: Invalid argument
I still cannot clone that github repo. Any other idea I can try to fix this problem? What am I missing?
git clone <url>
gives the message fatal: repository ‘url’ not found
I tried the options in the link, but it didn’t work.
asked Sep 20, 2014 at 8:56
7
As mentioned by others the error may occur if the url is wrong.
However, the error may also occur if the repo is a private repo and you do not have access or wrong credentials.
Instead of
git clone https://github.com/NAME/repo.git
try
git clone https://username:password@github.com/NAME/repo.git
You can also use
git clone https://username@github.com/NAME/repo.git
and git will prompt for the password (thanks to leanne for providing this hint in the comments).
answered May 24, 2015 at 21:52
Christian FriesChristian Fries
16.2k10 gold badges56 silver badges67 bronze badges
15
On macOS it’s possible that the cached credentials in the Keychain that git is retrieving are wrong.
It can be an outdated password or that it used the wrong credentials.
To update the credentials stored in OS X Keychain
Follow the instructions at:
https://help.github.com/articles/updating-credentials-from-the-osx-keychain/
If you want to verify this is the problem you can run clone with tracing.
$ GIT_CURL_VERBOSE=1 git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
Look for the header line «Authorization: Basic BASE64STRING» .
Take the base64 string and decode it to check what username:password was used.
$ echo <the key> | base64 --decode
Verify it’s the right username password you expected to use.
answered Jun 16, 2016 at 8:01
tsafrirtsafrir
1,71112 silver badges13 bronze badges
4
If your git repo is private, try this
git clone https://<USERNAME>:<PASSWORD>@github.com/<USERNAME>/<REPO_NAME>.git
Note: If you are using @ symbol in your password, use ‘%40’ to instead ‘@’
else use this
git clone https://github.com/<USERNAME>/<REPO_NAME>.git
—-Update:—-
Using a password in clone URL is now deprecated instead use the personal access token like below
Setting -> Developer Settings -> personal access tokens -> generate new token
git clone https://<Token>@github.com/<USERNAME>/<REPO_NAME>.git
answered Nov 27, 2020 at 15:16
3
If you are on Windows, the repository is private, and different or not longer correct credentials were saved once, you won’t have access to the repo. You will get the not found error without hinting in the failed-credential-direction. In order to reset the credentials on Windows, open Control Panel (Win+r control), select User Accounts and Credentials Manager or search for «credential manager» in Start Menu. Locate the git account in Windows credentials (not Web credentials!) and erase this entry.
After that, cloning will pop up a login dialogue and you will be able to set these again.
Tested this with git-bash as shell
In other languages
In Start menu search for
- En: «Credential Manager«
- NL: «Referentiebeheer «
- DE: «Anmelde Informationsverwaltung«
- KR: «자격 증명 관리자«
answered Jan 8, 2020 at 9:50
theking2theking2
2,2041 gold badge28 silver badges36 bronze badges
2
If you are using two factor authorization (2FA) for your Github account then just use SSH option for cloning your repository:
answered Apr 1, 2018 at 3:56
OlegdaterOlegdater
2,39122 silver badges20 bronze badges
0
I had the same problem (Repository not found
) due to the fact that initially I logged in with an incorrect GitHub account. To fix it:
- Open Control Panel from the Start menu.
- Select User Accounts.
- Select «Manage your credentials» in the left hand menu.
- Delete any credentials related to Git or GitHub.
pmichna
4,80013 gold badges53 silver badges90 bronze badges
answered Oct 26, 2018 at 8:36
YuraYura
2,9252 gold badges18 silver badges27 bronze badges
3
Most probably, your URL is not valid.
If it is a http/https URL, you can quickly check, by hammering the URL into a browser. If that does not display anything at all, you know that the URL is invalid.
I assume you are speaking of a remote repository. The URLs should look somewhat like these:
https://github.com/user/repo2.git if you're using HTTPS
git@github.com:user/repo2.git if you're using SSH
answered Sep 20, 2014 at 9:03
Kai MatternKai Mattern
3,0902 gold badges34 silver badges37 bronze badges
1
I was also having same issue. I was trying to clone the repo which was private and my git installed in osx has keychain which was not allowing me to clone the repo…
I tried
git clone https://username:password@github.com/NAME/repo.git
but it didn’t work as my password was containing the field @.
I just ran
git credential-osxkeychain erase
host=github.com
protocol=https
command and press enter and it worked perfectly fine. Actually you need to remove the keychain already stored in the osx.
answered Jul 27, 2016 at 11:35
Vikas ChandraVikas Chandra
5651 gold badge9 silver badges22 bronze badges
For me
git clone https://username@github.com/name/repo.git
worked.
I think this mainly happens because Private repo can’t be accessed directly.
Eric Aya
69.5k35 gold badges181 silver badges253 bronze badges
answered Jul 27, 2017 at 11:46
Manish MenariaManish Menaria
24.1k3 gold badges21 silver badges23 bronze badges
1
What solved my problem, since I was having a «redirect/sign_in URL» or «repository not found» error
MacOS Users:
- Open spotlight (Command Space)
- Type keychain (Open keychain access.app)
- Search for repo domain (GitHub, GitLab, etc)
- Delete all keys related to this domain
- Try to clone again (with valid credentials)
Windows users should try similar steps, but Keychain would be Microsoft’s Credentials Manager instead or Windows Credentials depending on yours OS version. Make sure to clean both web and windows credentials if that’s the case.
Zoe♦
27.1k21 gold badges119 silver badges148 bronze badges
answered May 2, 2018 at 12:57
Victor OliveiraVictor Oliveira
3,3037 gold badges47 silver badges77 bronze badges
3
git clone https://username@github.com/User/Repository.git
will prompt for a password then clone.
answered Feb 24, 2019 at 5:37
1
On github you can have the main repository and subfolders. Make sure that the URL that you are using is that of the main repository and not that of a folder. The former will succeed and the latter will produce the repository not found error. If you have a doubt you are in a subfolder, navigate up the repository chain till you find a page which actually specified the https URL and use that.
answered Jun 6, 2015 at 13:31
1
Step 1:
From your Github account, go to Settings
Account Settings
Then, Developer Settings
Developer Settings
Then Personal Access Token
PAT Settings
Then, Generate New Token (Give your password)
Generate Token
Now Fillup the form (scope/access permission of the repository) and click Generate token and Copy the generated Token (Copy and save it, it will be shown for the first time only, otherwise you have to generate it again), it will be something like ghp_sFhFsSHhTzMDreGRLjmks4TzuzgthdvfsrtaCopy Token
Step 2:
Now, copy the resource indicator:Resource Indicator
For example: https://github.com/AnwarXahid/sso-client-java-servlet.git and it is generated by https://github.com/**YOUR USERNAME**/YOUR REPO NAME.git
Finally, open terminal/ git bash and add the PAT token before resource indication:
For example: https://ghp_sFhFsSHhTzMDreGRLjmks4Tzuzgthdvfsrta@github.com/AnwarXahid/sso-client-java-servlet.git
Basically, it is generated by https://YOUR TOKEN@github.com/YOUR USERNAME/YOUR REPO NAME.git
So, the final command would like this: git clone https://YOUR TOKEN@github.com/YOUR USERNAME/YOUR REPO NAME.git
Press ENTER and your repo will be cloned to local!
answered Aug 23, 2021 at 6:16
XahidXahid
991 silver badge6 bronze badges
3
This is happening because of my old session state of other user remain: Below is quick solution for Windows users,
Open Control Panel from the Start menu
Select User Accounts
Select «Manage your credentials» in the left hand menu
Delete any credentials related to Git or GitHub
Once I did this, it started working for me.
answered Oct 8, 2018 at 12:42
Amjad KhanAmjad Khan
611 silver badge3 bronze badges
For me the problems occurs because I have my old username/password settings saved for gitlab, so that I need to remove those credentials. I run the following command on my mac:
sudo su
git config --system --unset credential.helper
and do the clone again, enter the username and password. And everything is fine.
answered Oct 10, 2020 at 3:19
de lide li
8821 gold badge13 silver badges25 bronze badges
This issue started surfacing on my terminal after I enabled GitHub 2FA.
Now, I face this issue whenever I clone a private repository. This error:
remote: Repository not found.
fatal: repository ‘https://github.com/kmario23/repo-name.git/’ not found
is so awkward. Of course, I have this repo and I’m the owner of it.
Anyway, it seems the fix is now that we have to enter the GitHub username
one more time when cloning a private repo. Below is an example:
add your username
|-------|
$ git clone --recursive https://kmario23@github.com/kmario23/repo-name.git
answered Dec 1, 2019 at 17:33
kmario23kmario23
57.4k13 gold badges162 silver badges150 bronze badges
0
Step 1:
Copy the link from the HTTPS
Step 2: in the local repository do
git remote rm origin
Step 3: replace github.com with username.password@github.com in the copied url
Step 4:
git remote add origin url
answered Jan 31, 2021 at 11:54
Viraj SinghViraj Singh
1,9711 gold badge17 silver badges27 bronze badges
git clone https://<USERNAME>@github.com/<REPONAME>/repo.git
This works fine. Password need to provide.
answered Jan 29, 2021 at 8:59
1
I’m a devops engineer and this happens with private repositories. Since I manage multiple Github organizations, I have a few different SSH keys. To overcome this ERROR: Repository not found. fatal: Could not read from remote repository.
error, you can use
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o User=git -i ~/.ssh/ssh_key_for_repo"
git clone git@github.com:user/repo.git
answered Jul 19, 2019 at 17:51
For me it worked by removing the credential.helper
config and cloning the repository again
git config --global --unset credential.helper
git clone https://<repository>
answered Jun 22, 2020 at 3:54
linktoahreflinktoahref
7,8223 gold badges30 silver badges51 bronze badges
0
You may need to create an empty file named git-daemon-export-ok
within the repository directory.
answered Jun 28, 2015 at 11:18
mono blainemono blaine
1,0019 silver badges13 bronze badges
0
Authentication issue:
I use TortoiseGit GUI tool, I need to tell tortoise the username and password so that it can access to work with Git/GitHub/Gitlab code base.
To tell it,
rt click inside any folder to get TortoiseGit menu.
Here TortoseGit > Settings Window > Select Credentials in left nav tree
Enter
URL:Git url
Helper: Select windows if your windows credentials are same as the ones for Git or ‘manager’ if they are different
userName; Git User Name
Save this settings ans try again. You will be prompted for password and then it worked.
answered Feb 3, 2019 at 1:06
If you are using cygwin for git and trying to clone a git repository from a network drive you need to add the cygdrive path.
For example if you are cloning a git repo from z:/
$ git clone /cygdrive/z/[repo].git
answered Oct 26, 2018 at 8:46
Possibly you did login in another account, and that account doesn’t have access rights to this repo, if you’re using mac os, go to Keychain Access, search for gitlab.com and remove it and try to git clone again.
answered Sep 16, 2019 at 23:58
Hieu VoHieu Vo
3,11530 silver badges31 bronze badges
You should check if you have any other github account marked as «default». When trying to clone a new repo, the client (in my case BitBucket) will try to get the credentials that you have set «as default». Just mark your new credentials «as default» and it will allow you to clone the repo, it worked for me.
answered Jun 25, 2020 at 16:25
Another reason for this error, if you are on github, and trying to use deploy keys for multiple repos, you will find this does not work.
In that case you need to create a machine user, however if you don’t and you try to clone any repo besides the one with the deploy key, you will get this error.
answered Sep 14, 2020 at 1:10
quickshiftinquickshiftin
66.5k10 gold badges68 silver badges89 bronze badges
I had this issue recently and after quite a bit of debugging I realized that the password that I got from a password generator had an «&» in it, which GitHub accepted, but Visual Studio Code did not like when I tried to clone the reopo. Not sure which system threw the error, but it made me realize that stage characters in your user name or password could also cause this issue.
answered Jun 14, 2021 at 11:12
phunderphunder
1,6173 gold badges17 silver badges33 bronze badges
I had this same problem in Windows, when I tried to use Git on the command line in Git Bash terminal while having also GitHub desktop installed. So, I did not have any problem using desktop app, but trying to clone in Git Bash failed. There are lots of advice for deleting any previous Git and GitHub related credentials, but this would then mess up GitHub desktop so it is not a good solution if you want to use both GUI and command line methods.
Surprisingly, when I just used Windows command prompt interface (Git CMD) instead of Git Bash, it started working. So, it seems Git Bash has problems co-operating with GitHub desktop configurations, but Windows command prompt works ok.
answered Sep 9, 2021 at 16:53
I tried following and it worked on macOS
- Save the work and restart the system
- ssh-add ~/.ssh/id_rsa
answered May 15, 2022 at 18:13
RameshRamesh
1,70318 silver badges13 bronze badges
после этого
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гб
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
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. Выполнить клонирования репозитория.