Git clone ошибка авторизации

Trying to access private corporate tfs.
They gave me access by giving appropriate rights to windows user (domain\login).

I’m fine with accessing web interface of tfs, browse repository and stuff.

But when I try to run

 git clone https://tfs.somehostname.com/tfs/somefolder/_git/therepository

It fails with

Cloning into 'therepository'...

fatal: Authentication failed for 'https://tfs.somehostname.com/tfs/somefolder/_git/therepository/'

Tried with home pc without corporate network stuff — same error.

Tried in PowerShell, Git Bash, Clone via VisualStudio — same error.

SSH is closed (gave request timeout).

Web & Git both ask for credentials once (tried deleting in Credentials Manager — asks again, after submitting web is fine, git fails)

Corporate helper tried to help, but all he gave is tfs logs.
He says, my username doesn’t come with requests (tracked by syncing my attempts timestamps with logs).

2018-07-19 07:04:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.12.2+(Microsoft+Windows+NT+6.3.9600.0;+Win32NT+x64)+CLR/4.0.30319+VS15/15.0.0 - 401 2 5 62
2018-07-19 07:23:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.18.0.windows.1 - 401 2 5 62
2018-07-19 07:23:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.18.0.windows.1 - 401 1 3221225581 187

while others include it

2018-07-19 05:44:27 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 DOMAIN\LOGIN ANOTHERIP git/2.12.2+(Microsoft+Windows+NT+6.1.7601+Service+Pack+1;+Win32NT+x64)+CLR/4.0.30319+VS15/15.0.0 - 200 0 0 265

Trying to access private corporate tfs.
They gave me access by giving appropriate rights to windows user (domain\login).

I’m fine with accessing web interface of tfs, browse repository and stuff.

But when I try to run

 git clone https://tfs.somehostname.com/tfs/somefolder/_git/therepository

It fails with

Cloning into 'therepository'...

fatal: Authentication failed for 'https://tfs.somehostname.com/tfs/somefolder/_git/therepository/'

Tried with home pc without corporate network stuff — same error.

Tried in PowerShell, Git Bash, Clone via VisualStudio — same error.

SSH is closed (gave request timeout).

Web & Git both ask for credentials once (tried deleting in Credentials Manager — asks again, after submitting web is fine, git fails)

Corporate helper tried to help, but all he gave is tfs logs.
He says, my username doesn’t come with requests (tracked by syncing my attempts timestamps with logs).

2018-07-19 07:04:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.12.2+(Microsoft+Windows+NT+6.3.9600.0;+Win32NT+x64)+CLR/4.0.30319+VS15/15.0.0 - 401 2 5 62
2018-07-19 07:23:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.18.0.windows.1 - 401 2 5 62
2018-07-19 07:23:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.18.0.windows.1 - 401 1 3221225581 187

while others include it

2018-07-19 05:44:27 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 DOMAIN\LOGIN ANOTHERIP git/2.12.2+(Microsoft+Windows+NT+6.1.7601+Service+Pack+1;+Win32NT+x64)+CLR/4.0.30319+VS15/15.0.0 - 200 0 0 265

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:

> 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 have installed the git command line.
Every time I try to clone a repo I get an authentication error.

fatal: Authentication failed for ….

It works on my mac but not on my windows laptop. Does anyone have an idea?

asked Apr 6, 2017 at 8:19

hurich's user avatar

hurichhurich

112 silver badges4 bronze badges

4

you can use code in command line

git clone https://username@example.com/.../project_name.git

or

git clone https://username:password@example.com/.../project_name.git

answered Jul 20, 2019 at 11:00

mehnet ali's user avatar

mehnet alimehnet ali

733 silver badges12 bronze badges

Should save git auth username and password on windows credential manager
enter image description here

answered Apr 25, 2018 at 9:04

Aymen Boumaiza's user avatar

Aymen BoumaizaAymen Boumaiza

1,3491 gold badge9 silver badges9 bronze badges

I have got same error. Go to control panel -> User Account —> Credential Manager
and edit git credentials.

enter image description here

Manoj's user avatar

Manoj

2,0693 gold badges12 silver badges24 bronze badges

answered Nov 23, 2020 at 10:08

kundan's user avatar

When trying to clone a Git repository, you may encounter an authentication error that states “Authentication failed for \<URL\>”. This error usually occurs when you do not have the necessary permissions or do not have the correct authentication credentials to access the repository. In this guide, we will explore the possible causes of this error and how to fix it with code examples.

Possible causes of the Authentication Failed error

Incorrect Username or Password

One of the most common causes of the “Authentication failed” error is an incorrect username or password. Ensure that you have the correct login credentials for the repository you are trying to access. You can check this by going to the repository’s website and logging in with your credentials.

Invalid SSH Key

If you are using SSH to authenticate to the repository, ensure that you have a valid SSH key. You can check this by running the following command in your terminal:

$ ssh -T git@github.com

If you see a message that says “Hi \<username\>! You’ve successfully authenticated, but GitHub does not provide shell access.”, your SSH key is valid. If you see an error message, you may need to generate a new SSH key.

Two-Factor Authentication

If you have enabled two-factor authentication for your Git repository, you will need to generate a personal access token (PAT) and use it instead of your password. You can generate a PAT by following these steps:

  1. Go to your repository’s website and navigate to the “Settings” page.
  2. Click on “Developer settings” and then “Personal access tokens”.
  3. Click on “Generate new token” and follow the prompts.
  4. Copy the generated token and use it as your password when cloning the repository.

How to fix the Authentication Failed error

Using HTTPS

If you are cloning a repository using HTTPS, you can fix the “Authentication failed” error by providing your username and password in the Git command. For example:

$ git clone https://username:password@github.com/username/repo.git

Using SSH

If you are using SSH to clone a repository, you can fix the “Authentication failed” error by ensuring that your SSH key is valid and registered with the repository. You can also try adding your SSH key to the SSH-agent by running the following command:

$ ssh-add ~/.ssh/id_rsa

Conclusion

If you encounter the “Authentication failed” error while trying to clone a Git repository, it is likely due to an incorrect username or password or an invalid SSH key. By following the steps outlined in this guide, you should be able to fix the error and successfully clone the repository.

Понравилась статья? Поделить с друзьями:
  • Ginzzu посудомойка ошибки
  • Gilgen door systems ошибка e105
  • Gimp ошибка при извлечении временных файлов
  • Gimbal motor load too large ошибка mavic pro
  • Gilgen ошибка е2000