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 «Creating a personal access token.»
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'
git clone <url>
gives the message fatal: repository ‘url’ not found
I tried the options in the link, but it didn’t work.
Trilarion
10.4k9 gold badges64 silver badges102 bronze badges
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
15.8k10 gold badges55 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,70112 silver badges13 bronze badges
4
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. 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
Search for
- En: Win+s «Credential Manager»
- NL: Win+s «Referentiebeheer»
- DE: Win+s «Anmelde Informationsverwaltung»
answered Jan 8, 2020 at 9:50
theking2theking2
1,8101 gold badge24 silver badges30 bronze badges
1
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
GopalGopal
2,07323 silver badges17 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,31122 silver badges20 bronze badges
0
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,0912 gold badges33 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
5551 gold badge9 silver badges22 bronze badges
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,72012 gold badges52 silver badges89 bronze badges
answered Oct 26, 2018 at 8:36
YuraYura
2,7352 gold badges18 silver badges25 bronze badges
3
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.1k35 gold badges179 silver badges250 bronze badges
answered Jul 27, 2017 at 11:46
Manish MenariaManish Menaria
21.5k3 gold badges20 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.
answered May 2, 2018 at 12:57
Victor OliveiraVictor Oliveira
2,8796 gold badges45 silver badges74 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
891 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
8621 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
55k13 gold badges155 silver badges148 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,54715 silver badges26 bronze badges
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,4893 gold badges32 silver badges49 bronze badges
0
git clone https://<USERNAME>@github.com/<REPONAME>/repo.git
This works fine. Password need to provide.
answered Jan 29, 2021 at 8:59
1
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,0039 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
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
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
2,99528 silver badges31 bronze badges
In my case. repository is private I can’t access it directly. On ly way to use Github Desktop app to fetch this repo.
answered Apr 11, 2020 at 6:06
uzair razauzair raza
151 silver badge8 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
64.1k9 gold badges66 silver badges88 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,5473 gold badges15 silver badges30 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
Содержание
- Troubleshooting cloning errors
- In this article
- Help us make these docs great!
- Bitbucket Support
- Knowledge base
- Products
- Jira Software
- Jira Service Management
- Jira Work Management
- Confluence
- Bitbucket
- Resources
- Documentation
- Community
- Suggestions and bugs
- Marketplace
- Billing and licensing
- Viewport
- Confluence
- Git ssh clone fails with error Permission denied (publickey) in Bitbucket Server
- Related content
- Still need help?
- Summary
- Environment
- Diagnosis
- Cause
- Solution
- Bitbucket Support
- Knowledge base
- Products
- Jira Software
- Jira Service Management
- Jira Work Management
- Confluence
- Bitbucket
- Resources
- Documentation
- Community
- Suggestions and bugs
- Marketplace
- Billing and licensing
- Viewport
- Confluence
- Git clone fails when cloning via SSH
- Related content
- Still need help?
- Problem
- Diagnosis
- Cause
- Ошибка: Permission denied (доступ запрещен) /публичный ключ/
- Можно ли использовать в Git команду sudo ?
- Проверьте, что вы подключились к нужному серверу
- Всегда использовать пользователя «git»
- Убедитесь, что у вас есть ключ, который используется
- Name already in use
- gitlabhq / doc / topics / git / troubleshooting_git.md
Troubleshooting cloning errors
In this article
If you’re having trouble cloning a repository, check these common errors.
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:
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 :
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 «Creating a personal access token.»
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:
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.»
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:
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:
Then, you can just switch to your new branch:
Help us make these docs great!
All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.
Источник
Bitbucket Support
Knowledge base
Products
Jira Software
Project and issue tracking
Jira Service Management
Service management and customer support
Jira Work Management
Manage any business project
Confluence
Bitbucket
Git code management
Resources
Documentation
Usage and admin help
Answers, support, and inspiration
Suggestions and bugs
Feature suggestions and bug reports
Marketplace
Billing and licensing
Frequently asked questions
Viewport
Confluence
Git ssh clone fails with error Permission denied (publickey) in Bitbucket Server
Related content
Still need help?
The Atlassian Community is here for you.
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms .
Summary
Ssh git clone fails with the following error.
In order to get a more detailed output, you can try the command, GIT_SSH_COMMAND= «ssh -vvvv» git clone ssh://git@ and this will give you the output similar to the below one.
Environment
Bitbucket Server/Data Center 7.17.0 or above installed on Ubuntu 14.x LTS or Ubuntu 16.x
Diagnosis
Run ssh localhost from the same machine and retry the clone. It will get successful and you can see the below line in the success output.
Cause
When running the clone directly from the client machine, the key is being accessed from the ssh agent gnome-keyring in the Operating system. This is a feature that collects all of your passwords in a secure application (gnome-keyring) and will use these stored passwords to automatically log you in to various services. But it is possible that the passwords stored in the keyring could get outdated and this could cause authentication failures.
To confirm this, you can run the below command twice. Once directly on the machine, then after executing » ssh localhost «.
You can see similar output.
The SSH_AUTH_SOCK path variable has been cleared once you run ssh localhost and the key is being taken from the default ssh configuration.
Solution
Please work with your system admin and disable the gnome-keyring: ssh agent in your system(not the server) or you can manually unset the SSH_AUTH_SOCK environment variable.
Источник
Bitbucket Support
Knowledge base
Products
Jira Software
Project and issue tracking
Jira Service Management
Service management and customer support
Jira Work Management
Manage any business project
Confluence
Bitbucket
Git code management
Resources
Documentation
Usage and admin help
Answers, support, and inspiration
Suggestions and bugs
Feature suggestions and bug reports
Marketplace
Billing and licensing
Frequently asked questions
Viewport
Confluence
Git clone fails when cloning via SSH
Related content
Still need help?
The Atlassian Community is here for you.
Platform Notice: Cloud, Server, and Data Center — This article applies equally to all platforms .
Problem
Git clones fail when using ssh even if an Access key has been added to the repository or an SSH key has been added to the user’s profile.
Diagnosis
Diagnostic Steps
- Ensure an SSH key has been added to the user or the repository
Check the existing keys on the client by running
Attempt to clone a change to the repository with the Git client debug on:
The log will show which key has been used for the authentication and which ones have been tried. The line to check will look like the following:
Cause
Once excluded that the correct key is used, this may be caused by an unknown issue with the existing keys.
Источник
Ошибка: Permission denied (доступ запрещен) /публичный ключ/
Ошибка «Permission denied» (доступ запрещён) означает, что сервер отклонил ваше соединение. У этой ошибки может быть несколько причин; наиболее общие из них приведены ниже.
Можно ли использовать в Git команду sudo ?
Вы не должны использовать команду sudo с Git. Если у вас есть веская причина использовать sudo , убедитесь, что вы используете её с каждой командой (возможо, лучше использовать su чтобы получить оболочку с правами суперпользователя (администратора) в этом месте). Если вы сгенерировали SSH-ключ без sudo , а затем пытаетесь использовать команду, подобную sudo git push , вы не должны использовать те же ключи, которые сгенерировали.
Проверьте, что вы подключились к нужному серверу
Будьте внимательны при вводе команд с клавиатуры. В некоторых случаях корпоративная сеть может привести к проблемам разрешения записи DNS.
Так как документ подготовлен в рамках курсов повышения квалификации «Правильный курс» , то и проверка подключения будет описана именно на этом примере.
Напомним, что доступ к репозиторию [email protected] организован по порту 25000, а не по стандартному для SSH порту 22. Поэтому в команде подключения вы должны явно указать номер порта.
Для того, чтобы убедиться в том, что вы подключаетесь к нужному домену, введите следующую команду, добавив в строке номер порта ‘-p 2500’ :
Всегда использовать пользователя «git»
Все соединения длджны выполняться под пользователем «git». Если вы попытаетесь соединиться под вашим псевдонимом в propercourse, соединение не установится:
Вместо этого вы должны проверить соединение, набрав в строке:
Убедитесь, что у вас есть ключ, который используется
Если вы используете Git Bash, включите ssh-agent:
Если вы используете другой командный процессор, такой как, например, Git для Windows, включите ssh-agent:
Проверьте, что у вас есть сгенерированный и загруженный в SSH приватный ключ.
Если вы используете OpenSSH 6.7 или более ранний:
Если вы используете OpenSSH 6.8 или более позднюю:
Команда ssh-add должна вывести длинную строку из цифр и букв. Если ничего не будет выведено на экран, вы должны сгенерировать новый SSH-ключ и связать его с GitLab.
/.ssh/identity ) автоматически добавляются к агенту аутентификации SSH. Вы не должны запускать ssh-add path/to/key , иначе вы перезапишите имя файла при генерации ключа.
Получение детализации
Вы можете также проверить, что ключ используется при попытках соединения с [email protected] :
Источник
Name already in use
gitlabhq / doc / topics / git / troubleshooting_git.md
- Go to file T
- Go to line L
- Copy path
- Copy permalink
Copy raw contents
Copy raw contents
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:
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’s configuration.
Example of an error during a clone: fatal: pack has bad object at offset XXXXXXXXX: inflate returned -5
Open a terminal and enter:
The value is specified in bytes, so in the above case the buffer size has been set to 50MB. The default is 1MB.
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:
/.ssh/config (create the file if it doesn’t exist) and add or edit:
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», set Seconds between keepalives (0 to turn off) to 60 .
To configure SSH on the server side, edit /etc/ssh/sshd_config and add:
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 (see Broken pipe when pushing to Git repository).
Users may experience the following error when attempting to push or pull using Git over SSH:
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.
If the configuration check runs without errors, it should be safe to restart the SSH daemon for the change to take effect.
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:
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:
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 of 1 . 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, if git clone fails when cloning a 500 MB repository, you should set http.postBuffer to 524288000 :
You can increase the http.postBuffer on the server side:
Modify the GitLab instance’s gitlab.rb file:
After applying this change, apply the configuration change:
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:
Requests made with a SSO account and where password_expires_at is not null return this error:
To resolve this issue, you can update the password expiration by either:
Using the gitlab-rails console :
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.
Источник
Adblock
detector
Problem
During a clone or fetch, Git fails with the following errors:
Example 1
git clone http://bitbucket.company.com:7990/scm/proj/repo.git
fatal: early EOF
fatal: The remote end hung up unexpectedly
fatal: index-pack failed
error: RPC failed; result=56, HTTP code = 200
Completed with errors, see above.
Example 2
git clone fails after 1 GB
git clone http://bitbucket.company.com:7990/scm/proj/repo.git. Cloning into 'repo'....git
remote: Counting objects: , done.
remote: Compressing objects: 100% (####/###), done.
fatal: The remote end hung up unexpectedly.00 GiB | MiB/s
fatal: early EOF
fatal: index-pack failed
and in atlassian-bitbucket.log
2017-07-26 12:39:18,819 INFO [http-nio-7990-exec-8] <user> @4MMSRUx758x33193x0 <IP> "POST /scm/team/<repo>/git-upload-pack HTTP/1.0" c.a.s.i.w.filters.StreamGuardFilter The remote client has aborted the connection
Diagnosis
This behavior is usually related to an intermediary that is terminating the request. Removing the intermediary from the equation and checking if the import would work can speed up the troubleshooting process.
For that, temporarily disable any firewall or anti-virus software and attempt the clone again or make an exception rule in the firewall settings.
To turn on Git debug logging, before pushing using the command line, proceed like this for different OS:
On Linux
Execute the following in the command line before executing the Git command:
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
On Windows
Execute the following in the command line before executing the Git command:
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
Cause
Possible causes include:
- Cause #1 git debug output has
error: RPC failed; result=56, HTTP code = 200
Error code 56 indicates acurl
receive error ofCURLE_RECV_ERROR
which means there was some issue that prevented the data from being received during the clone process. Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred. -
Cause #2 There is no error code and git debug log shows that Nginx is configured as reverse proxy. Git clone fails after 1 GB.
e.g.< HTTP/1.1 200 < Server: nginx/1.10.2
Workaround
Workaround for Cause #1: Switch to using SSH to perform the clone.
Workaround for Cause #2: Bypass the proxy and clone. e.g. How do I bypass a proxy for bitbucket server
Resolution
- Resolution for Cause #1:
Change the anti-virus settings, firewall settings, or VPN client so that they allow connections from Bitbucket Server and do not terminate them prematurely. The specific change that needs to be done will depend on the technology being used and sometimes it will be helpful to check the vendor documentation. - Resolution for Cause #2:
Disable the default 1GB limit of proxy_max_temp_file_size for Nginx. Value need to be set as zero to disable it
You can find more details here http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size .