12

Why doesn't Egit accept username and password when fetching from remote?

These are the steps I follow:

  1. In Git Repositories view I expand Project -> Remotes -> origin
  2. Right click on origin -> fetch
  3. Login mask appears; I insert User and Password
  4. Repeat step 3 other two times
  5. An error message appears: https://companyname.visualstudio.com/.../projectname: not authorized

Credentials are correct and I am authorized because I use them daily with any kind of git interface: TortoiseGit, SmartGit, Git Bash, ...

I did research but didn't find this problem. Also similar questions don't address this problem.


Update: I used a workaround following this guide. I created an access token from the Visual Studio Team Services account and I'm using that as password.

My git installation is using Git Credential Manager (GitHub page, Microsoft guide to GCM) to store credentials, in fact when I ran for the first time git through the interfaces I mentioned above and tried to connect to the Team Services Git repository the Microsoft Account login window popped up and that was it. Also I can tell it from runnig the command git config --list and getting credential.helper=manager.

Eclipse has the Team Explorer Everywhere plug-in installed, so it should interact with Git Credential Manager and accept the Microsoft Account credentials, but it doesn't. So this is still an open issue.

Luke
  • 1,633
  • 3
  • 23
  • 37
  • is your git server setup with your username and password (locally) or what? are you thinking that it will use your AD credentials ? how is the authentication and authorization solution setup ?? – MrSimpleMind Sep 11 '17 at 11:22
  • do you use the TFS plugin for eclipse? https://msdn.microsoft.com/en-us/library/hh301122(v=vs.120).aspx – MrSimpleMind Sep 11 '17 at 11:26

5 Answers5

22

I was facing the same issue

From git side settings-->developer settings-->Personal access tokens-->generate new token-->copy that token and use that token as password.

4

The way to fix this is to go to

Window->Preferences->Team->Git

And then change the HTTP client from Apache HTTP to Java Built-in HTTP

Spiff
  • 3,873
  • 4
  • 25
  • 50
3

The Git clients you mention uses "native" git, and the credentials are provided transparently during the communication with the server.

Eclipse git client (jgit+egit) is full-java based, and unfortunately you can't use native git in Eclipse.

Either your Git server has user+password locally (not so enterprise-ish!) or you could use Kerberos tickets in Eclipse git; but before you run Eclipse you should do a kinit to create a ticket with your user logon, that is accessible from java process. (Normally the ticket is in your user home directory)

Example using kinit:

enter image description here

I m not so sure about the TFS plugin, but maybe in your case it is worth to install it and see if it helps you instead of the embedded egit, see https://msdn.microsoft.com/en-us/library/hh301122(v=vs.120).aspx

MrSimpleMind
  • 7,890
  • 3
  • 40
  • 45
  • Why can my teammates use Eclipse to connect to remote without running any of these steps? Btw, I'm not the server manager and our operating system is Windows. – Luke Sep 11 '17 at 12:18
  • Ok but using above did not help? or you did not try? you can start eclipse in debug mode and see all network exchange (http and https), see what's going wrong etc. Check ssl log, maybe you need to import ca certificates to you cacert. – MrSimpleMind Sep 11 '17 at 12:55
  • Git clients I mentioned use Git Credential Manager to accept and store Microsoft Account credentials. See update for details. – Luke Sep 11 '17 at 14:51
  • @Luke from what I know, there is no official release of jgit that supports the Git credentials manager! It is not (yet) implemented! And definitly not bundled in any eclipse version! (I should know that ;) .. did you try anything from my previous comment? – MrSimpleMind Sep 11 '17 at 20:23
  • I tried TFS plugin, it installs Team Explorer Everywhere. I don't know how to run Kerberos commands or kinit in Windows. – Luke Sep 11 '17 at 21:11
  • See the installation path of your jdk/bin... %java_home%/bin.... where javac is located – MrSimpleMind Sep 11 '17 at 21:18
  • No, I get the IllegalArgumentException: Can not obtain principal name – Luke Sep 12 '17 at 07:49
  • Credentials cache C:\Users\\krb5cc_ not found. – Luke Sep 12 '17 at 07:58
  • Current ID access: 0: 0x3e710 Tickets memorized in cache: (0) – Luke Sep 12 '17 at 08:05
  • Seems so. filler filler – Luke Sep 12 '17 at 08:16
  • I m thinking how to get thru this without a lot of conf and settings, could use keytabe, krb5 conf, ini, etc. But it needs that you know what you do, and I "can not" write all steps. ;) ... What does the klist shows for your team mates ? how do you logon to windows? who is administrator? is it enterprise setup? can you install kerberos ui, http://web.mit.edu/kerberos/dist/ ? – MrSimpleMind Sep 12 '17 at 08:33
  • I can't run commands on their pcs... I logon with username (not microsoft, just pc username), I'm administrator, it's not enterprise setup it's a standalone pc. – Luke Sep 12 '17 at 08:39
  • does this mean you have a local user/password ? no AD login, you dont logon to a domain during logon on your windows pc? Well, I saw the token solution too, and I think you have to stick to it. As mentioned the jgit has no implementation to the (native) git cred.manager. Check also this url, and see if you find anything that helps https://stackoverflow.com/questions/15331166/how-to-make-egit-remember-password-and-username – MrSimpleMind Sep 12 '17 at 10:27
0

I had the same issue, not able to update the username in eclipse pop up while pushing to Git. Irrespective of username, I have provided the generated git credentials password and it worked.

0

Use personal access token for https. Fine graned tokens are preferred.

Refer. https://cse132.engineering.wustl.edu/files/githubEclipseAuth/githubEclipseAuth.html