4

so I'm trying to clone a git repository but it keeps throwing an error about a failed authentication..

Here is the error:

$ git clone https://url...
Cloning into 'repo'...
fatal: Authentication failed for 'https://url...'

I've checked my configs and the username and password for the repositry are correct but somehow the clone doesn't work.

Any tips on what I can do right now?

Brecherchef
  • 401
  • 6
  • 22
  • I know this doesn't answer the question directly, but consider using ssh for git connections. – evolutionxbox May 22 '18 at 09:17
  • Can you explain how I do that please? Im quite new to git.. – Brecherchef May 22 '18 at 09:21
  • use `git clone ssh://...´. A introduction regarding VSTS git authentification you'll find at https://learn.microsoft.com/de-de/vsts/git/use-ssh-keys-to-authenticate?view=vsts – milbrandt May 22 '18 at 09:33
  • https://help.github.com/articles/connecting-to-github-with-ssh/ explains how to use ssh keys and github, but the approach works with other repo hosting services as well. – evolutionxbox May 22 '18 at 09:33
  • Okay i've tried that now but it still doesn't work for me. – Brecherchef May 22 '18 at 09:59
  • You might also look over the answers from [question 11403407](https://stackoverflow.com/questions/11403407/git-asks-for-username-every-time-i-push?rq=1) which has some more ideas – Todd May 22 '18 at 10:32

1 Answers1

3

The Answers from question 11403407 fixed the issue.

The Code that worked for me looks like this:

git config --system --unset credential.helper

The --system was important here since --global didn't work.

Thanks for the help guys, especially @Todd! :)

Brecherchef
  • 401
  • 6
  • 22
  • 1
    For anyone who doesn't have perms to write to system config, putting `[credential] helper =` with no value after the `=` in your global config has the same effect – rbennett485 May 27 '18 at 10:10