Skip to content

Credentials not found using Username / Password in remote #906

Closed

Description

@pascalberger

If I have a remote like https://user:[email protected] git lfs still throws an error that credentials are not found. A normal git fetch works fine.

Trying to using this in a VSTS with the OAuth token passed from VSTS. See microsoft/azure-pipelines-tasks/issues/962.

Activity

  1. technoweenie commented on Dec 20, 2015

    @technoweenie
    Contributor

    Cool, thanks for the report. This is a pretty low priority bug though. Putting authentication info in your git config is a pretty terrible idea, security-wise.

  2. pascalberger commented on Dec 21, 2015

    @pascalberger
    Author

    @technoweenie I'm with you regarding using auth in the config and security. But my use case is that I need to fetch lfs objects on a build server (VSTS). I only have the OAuth token available and therefore temporarily change the remote url to contain the OAuth token to access the repo on the server.

    The other option would be to use a dedicated service account only for this and have its credentials stored permanently on the build agent which I think is worse security-wise.

  3. blazespinnaker commented on Dec 24, 2015

    @blazespinnaker

    This breaks for me as well. I'm just entering my credentials at the command line. Also, my repo isn't exact super duper secret territory considering it's all open source anyways... I honestly can't imagine why anyone would try to hack it.

  4. whoisj commented on Dec 25, 2015

    @whoisj

    Cool, thanks for the report. This is a pretty low priority bug though. Putting authentication info in your git config is a pretty terrible idea, security-wise.

    Is there a recommended solution to the problem presented?

    Is there something the GCM could be providing here?

  5. andyneff commented on Feb 3, 2016

    @andyneff
    Contributor

    This breaks for me too... My scenario is less security sketchy though... I have to have a username and password on the lfs server, but I have a "read only" permission account that I actually WANT to be public. That's the username and password in plain text that I want to have in the .lfsconfig file.

    Also, I noticed the lfs.url will parse the username only if its supplied but neither if both are supplied. e.g.

    url = http://[email protected]:1234/stuff.git/info/lfs
    

    Works

    For what its worth, my workaround is to set the store credential helper before hand...

    git config --global credential.helper "store --file=/pw.txt"
    echo "https://user:[email protected]:1234" > /pw.txt
    
  6. changed the title [-]Credentials not found using Username / Password in remot[/-] [+]Credentials not found using Username / Password in remote[/+] on Feb 9, 2016
  7. WestonThayer commented on Feb 11, 2016

    @WestonThayer

    @pascalberger were you ever able to get this working?

    @andyneff I tried that trick in VSTS to no avail. Are you on VSTS too?

  8. pascalberger commented on Feb 11, 2016

    @pascalberger
    Author

    @WestonThayer No, using a service account for just this is no option for us. Therefor unfortunately no git-lfs for us until this get fixed.

    @technoweenie Any chance to have the priority of this increased, since it seems like I'm not the only one with a use case requiring this?

  9. andyneff commented on Feb 11, 2016

    @andyneff
    Contributor

    @WestonThayer It should work on VSTS too. (I created an account real quick and tested it in a docker. It DOES work) If you are still having problems, it might be on how your VSTS account is setup (send me a private message on gitter if you want to discuss the VSTS part further).

    If you are using a service like VSTS, there is no need to set a custom lfs url, The credential storage will work for the normal git url AND the git lfs url, which will be based off of the same https url from VSTS

    In another scenario where you need to use an external lfs server, keep in mind what the FULL lfs url normally have something AFTER the *.git directory. This of course could vary from server to server, that's all beyond my scope.

    For example, a github.com url would be https://github.com/username/projectname.git, and you can NOT set the lfs.url to the exact same, because that's not the lfs url. The lfs url is https://github.com/username/projectname.git/info/lfs.

    @pascalberger Why can you not use the store credential in your situation? If you have a script on your build server, leave the url untouched in whatever script you are using, and just set the store credential (temporarily even, if that's all you want) and use a plain text file?

  10. pascalberger commented on Feb 11, 2016

    @pascalberger
    Author

    @andyneff I don't have user / pwd credentials but only an OAuth token to access the repo during the build. Of course I could create some service user, store his credentials on the build server and this way access the repository. But speaking about security this would make completely no sense, contrary to temporarily put an OAuth token in the remote.

  11. andyneff commented on Feb 11, 2016

    @andyneff
    Contributor

    @pascalberger Used OAuth is the username, and the <OAuth token> is the password. (Tested, and works)

    echo https://OAuth:[email protected] > /pw.txt
    

    Notice: there is NO path in that line, just the server

    Edit: I was using a "Personal access token" for this. If a build token doesn't work this way, sounds like a VSTS issue, and even if THIS issue was fixed, it wouldn't help.

    Also, I'm only testing all of this on my local machine, I was assuming once you get it working locally, the solution can be transferred to your build system

  12. WestonThayer commented on Feb 11, 2016

    @WestonThayer

    @pascalberger I chatted with Andy offline, we were on different pages. This is a VSTS build server issue (where they execute Git in a special context) as far as I can tell. Things that work on my local machine don't work on the VSTS build server.

  13. technoweenie commented on Mar 31, 2016

    @technoweenie
    Contributor

    Hey all, thanks again for the feedback. I've added this to the list for Git LFS v1.2. Though I really want to get a new release out next week, so it may have to wait for Git LFS v1.3 (unless someone steps up to do it). Here's a comment where I'm discussing next week's release: #844 (comment)

  14. jonmagic commented on Apr 8, 2016

    @jonmagic
    Contributor

    I've been trying to replicate this on master (with help from @technoweenie and @LizzHale) and haven't been able to yet. Here are the tests we wrote showing that it uses the user:pass pair from the url whether it is in the git config for lfs.url or remote.origin.url.

    Wondering if you can provide more details to help me replicate this? Or wondering if it got inadvertently fixed in the changes to master since the version the error was reported on?

  15. 8 remaining items

  16. technoweenie commented on Apr 8, 2016

    @technoweenie
    Contributor

    @andyneff was able to provide me an example that I could check out. Running with GIT_TRACE=1 showed me this:

    trace git-lfs: HTTP: POST https://USER:[email protected]/repo.git/info/lfs/objects/batch
    trace git-lfs: HTTP: 200
    trace git-lfs: HTTP: {"objects":[{"oid":"0000000000000000000000000000000000000000000000000000000000000000","size":1,"_links":{"download":{"href":"https://git-lfs-server.com/repo/info/lfs/objects/0000000000000000000000000000000000000000000000000000000000000000","header":{"Accept":"application/vnd.git-lfs"}}}}]}
    trace git-lfs: HTTP:
    Username for 'https://git-lfs-server.com':
    

    The LFS client is authenticating https://USER:[email protected]/repo.git/info/lfs/objects/batch properly. However, the LFS server is not returning authenticated urls to the requested objects, like https://git-lfs-server.com/repo/info/lfs/objects/0000000000000000000000000000000000000000000000000000000000000000. This is undesirable, but should be easy enough to fix.

  17. pascalberger commented on Apr 8, 2016

    @pascalberger
    Author

    And here my git lfs fetch with GIT_TRACE=1: https://gist.github.com/pascalberger/093fce9eea909db09968305b486d1083

    The output is until the first credential dialog appears (if I cancel the credential dialog two others appera until the command exits)

  18. technoweenie commented on Apr 8, 2016

    @technoweenie
    Contributor

    Cool thanks. Sorry for handling this poorly. I thought I knew exactly where the bug was. But if I'd have assumed ignorance and asked up front for debug data (like GIT_TRACE), I'd have solved this really quickly in Dec. A fix will be coming in v1.2 next week.

  19. andyneff commented on Apr 20, 2016

    @andyneff
    Contributor

    @pascalberger @WestonThayer

    With git lfs 1.2.0, I'm able to get my scenario working where I have my "oauth" key in .lfsconfig. Are you able to get it working in your scenario of git clone https://user:[email protected]?

  20. foresterre commented on May 10, 2016

    @foresterre

    I have the same issue on git lfs 1.2.0 on windows 8.1.

    git lfs env and git config --list:
    https://gist.github.com/foresterre/1c44f08cff4b31c77e0c8097fb506f04

    I enter my credentials on the command line.

  21. andyneff commented on May 10, 2016

    @andyneff
    Contributor

    @foresterre If you are supposed to enter your password on the command line is more about not having the password helper working. See here

  22. RagtagShawn commented on Jun 11, 2016

    @RagtagShawn

    What exactly is the work around if you're not on v1.2? I have to support a remote contractor using SourceTree on Windows and they (Atlassian) have not moved SourceTree to v1.2 yet on Windows. This user is not very technical so I'd like to keep it as simple as possible. Their current setup is using their normal GitHub credentials via https and keeps getting the authentication failure when they do a big push with a lot of LFS tracked files up to the remote at the end of the push command.

  23. andyneff commented on Jun 11, 2016

    @andyneff
    Contributor

    @RagtagShawn The same workaround should still work

    git config --global credential.helper "store --file=/pw.txt"
    echo "https://user:[email protected]:1234" > /pw.txt
    

    Where user is their username, pass is their password, blah.com:1234 would be the hostname and port of the external lfs repo, and /pw.txt would be the location for storing their password, in plain text, for all to see, that's why this isn't a great solution ;) But this solution/issue is geared towards more automated procedures (where prompting ONCE was a problem) than dealing with "being asked for a password multiple times", that sounds like the credential helper isn't set up.

    If they are using windows, I think the windows credential helper is good at remembering the password after prompting only once.

  24. RagtagShawn commented on Jun 11, 2016

    @RagtagShawn

    @andyneff Thanks for the quick reply.

    No the credential helper is not setup as described in that link because like I mentioned the user is using SourceTree and the embedded version of Git/LFS that comes with it. I am trying to keep the user's setup as easy as possible. Also they are not getting prompted for their credentials just the push keeps failing with the credential error and a git lfs pull command will not work due to the same error.

    Normal git commands are working and the push appears to be partially working because every time we re-initiate the push the output indicates LFS tracked files that are being skipped because they are presumably already pushed up to the LFS server.

    Anyway I am not a Git super user, so how exactly do I find the "would be the hostname and port of the external lfs repo"? Our repository is hosted on GitHub.

  25. andyneff commented on Jun 11, 2016

    @andyneff
    Contributor

    @RagtagShawn I don't know anything about SourceTree, but it sounds like you are not using the feature that this issue is about (username AND password in the url). This issue was a "it didn't work at all" kind of thing. You might try the chat room or asking SourceTree for help.

  26. RagtagShawn commented on Jun 12, 2016

    @RagtagShawn

    @andyneff You're right it was not exactly the same issue, but it was the same symptoms. I got around it by configuring the user's SourceTree to use the latest versions of Git for Windows and LFS. Not a big deal, but I was hoping to avoid extra installation steps for supporting less technical and remote users. Regardless your replies got me on the right track. Thanks!

  27. kkrugler commented on Jul 13, 2017

    @kkrugler

    I recently ran into this issue, when a few files were added to the GitHub repo that require git-lfs. Previously I'd configured my URL in .git/config to be something like https://<username>@github.com/<organization>/<reponame>.git, which was necessary once I enabled 2FA in GitHub (and I didn't want to jump through the password helper hoops).

    The git-lfs URL in the .git/config file looks similar:

    [lfs "https://<username>@github.com/<organization>/<reponame>.git/info/lfs"]`
    	access = basic
    

    But doing a pull returns Error downloading object: <path> (<hash>) for every file in GitHub that was added using LFS.

    Running git lfs logs last says:

    Git credentials for https://<author>@github.com/<organization>/<reponame>.git not found:
    'git credential fill' error: exit status 1
    

    If I put my access token in the URL (so now it's https://<author>:<access token>@github.com/<organization>/<reponame>.git) then I can clone, and it all works. But it's weird that regular git is fine with just my username, but LFS needs my access token.

    Finally, after the error, I had to explicitly run git lfs pull to pull down the files that failed during the git pull. Seems like git pull only runs git lfs pull if it has non-LFS files to pull.

  28. technoweenie commented on Jul 14, 2017

    @technoweenie
    Contributor
    Git credentials for https://<author>@github.com/<organization>/<reponame>.git not found:
    'git credential fill' error: exit status 1
    

    That's an error with Git. Maybe you don't have your git credential helper set up properly? Check out https://help.github.com/articles/caching-your-github-password-in-git/ for some help there.

    You can also run GIT_TRACE=1 git pull to get some more details about why your git credential helper didn't work.

    EDIT: If you're having credential helper problems, please post a new issue so we can help you out. I've locked this issue since the original request has been fulfilled, and individual requests for help don't need to email everyone else on this thread.

  29. locked and limited conversation to collaborators on Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions