%^&^*%*&^% Git.



  • @Magus said in %^&^*%*&^% Git.:

    @Jaloopa I'm loving working with open source software that is more powerful than what I previously had, and doesn't require hacks for what should be basic functionality.

    You are barking at the wrong tree. Git itself does not have that dialog when you install it from the vanilla installer. It is Visual Studio that pulls in and configures the Git Credential Manager for Windows when it installs Git during its own installation. The TFS build agent could be smart enough to disable it, after all it is part of the same product suite, but apparently it doesn't (it probably does within the default checkout module, but when you are scripting something additional…)


  • Discourse touched me in a no-no place

    @Magus said in %^&^*%*&^% Git.:

    Git launches a UI WINDOW to log in

    That sounds like it is configured to use a program for generating the credentials to secure its communications with. That's a pluggable interface in standard git. On OSX, I have this in my account-wide git configuration file (~/.gitconfig):

    [credential]
            helper = osxkeychain
    

    Is there something like it on your platform? I don't know exactly what to look for, of course, or precisely where to look (I'm assuming you're on Windows) and I wouldn't expected it to be identical, but if there's a credential helper configured then that could explain where the GUI is coming from and you might be able to then figure out how to fix it from there. I've no idea if this is configurable on a repository-by-repository basis, and I don't know if there's a basic fallback to using something icky but non-interactive like full credentials in the upstream repo URL.

    The other way to deal with this (if you're just doing build-server-y stuff and not pushing commits back to the main repository) is to configure the main repository to support URLs that allow read-only access without credentials. That's pretty common for, say, public github repositories, but not a good idea if the repository holder is world-reachable and holding a non-public repo. (The setup of such things depends on your network and the details of what you're doing, but a build-server in the same network zone as the repository could easily be given read-only access with the insecure access route then being blocked at the firewall to everywhere else.)

    Of course, if you're using a program that's called “git” but which is something else (perhaps it talks the same protocol but has some plugins baked in) then all bets are off.

    [EDIT] :hanzo:'d thoroughly…



  • @Gąska said in %^&^*%*&^% Git.:

    Ever heard of global variables?

    I use a language that doesn't have them. Why would the knowledge of the term "global variable" be required to use Git? What if I don't know anything about programming and just want a revision control system for my essays about the Civil War?

    I mean you gotta think about this shit, man. You can't just pull it out your ass and run it by your 9 friends, all of whom are the biggest programming nerds in the universe, and say "good enough". Stop and fucking think.

    (Of course I can guarantee the guy who introduced this term to Git didn't even survey 9 people. I bet he asked exactly zero people.)



  • @Bulb I am not barking up the wrong tree. If we were using TFS, I guarantee this would not be an issue. At all.

    Git absolutely should have an option to not allow popups as a commandline switch. It already has switches for rewriting its own history, which is an anti-feature. They could have taken time putting in actual features, but Linus.



  • @Gąska Yeah, great. Those things that aren't some sort of weird 'user-scoped but totally really global', right? Why are you bringing them up?



  • @Magus said in %^&^*%*&^% Git.:

    @Bulb I am not barking up the wrong tree. If we were using TFS, I guarantee this would not be an issue. At all.

    Git absolutely should have an option to not allow popups as a commandline switch. It already has switches for rewriting its own history, which is an anti-feature. They could have taken time putting in actual features, but Linus.

    So what should the switch do? Install hooks in all child processes git creates to disable UI system calls?



  • @Magus INB4 "It's OSS. Fork it and fix it if you don't like something instead of whining."


  • Banned

    @blakeyrat said in %^&^*%*&^% Git.:

    @Gąska said in %^&^*%*&^% Git.:

    Ever heard of global variables?

    I use a language that doesn't have them.

    But do you know what they are? Then you shouldn't have problems to understand what "global" is supposed to mean in context of configuration.

    I mean, yes, Git did get this wrong. But insisting "global" implies something globe-shaped, especially in context of computer software, is just stupid.



  • @Magus said in %^&^*%*&^% Git.:

    Problem: Git launches a UI WINDOW to log in, which I cannot do anything about, even when run from command line. This would be fine, but I'm doing this on the build server: it must not happen.

    I use git on Windows sometimes, and I've never had it switch between command line usage and GUI usage on me.

    What is the login window asking you to log in to? Can you set up SSH keys so you log in automatically?



  • @Captain It's true, I promise. It's also fixed by using vsts's access token from the build itself.



  • @Magus I do believe you, but I am wondering what it's asking you to log in to.



  • @Captain VSTS, which is where the repository is hosted.


  • Fake News

    @Captain said in %^&^*%*&^% Git.:

    @Magus I do believe you, but I am wondering what it's asking you to log in to.

    Ben already posted the link to the Git Credential Manager's repo but it's devoid of any screenshots, so here's an MSDN blog article with screenshots instead:

    It automates creating an OAuth2 / personal access token for you by showing a simple login form.

    EDIT: Also, turns out the GCM has a document on how to suppress the UI and optimize for build agents. It's more or less what I posted before, though the "optimization" stuff is new to me.



  • @JBert said in %^&^*%*&^% Git.:

    EDIT: Also, turns out the GCM has a document on how to suppress the UI and optimize for build agents. It's more or less what I posted before, though the "optimization" stuff is new to me.

    But again, only if you set it in your config file, and not as a non-saved switch, so it was never going to be the approach I used.



  • @Gąska said in %^&^*%*&^% Git.:

    But do you know what they are?

    I do, but do all expected users of Git do? Many modern languages, such as Java and C#, do not have such a concept. Is Git built only for people who use C?

    Who even IS their intended audience? Did they spend even 5 minutes thinking about that, or just start farting out low-quality shit-code?

    @Gąska said in %^&^*%*&^% Git.:

    I mean, yes, Git did get this wrong.

    Wow you admit that. Amazing.

    @Gąska said in %^&^*%*&^% Git.:

    But insisting "global" implies something globe-shaped,

    it does though.

    @Gąska said in %^&^*%*&^% Git.:

    especially in context of computer software, is just stupid.

    Happy to serve.


  • Banned

    @blakeyrat said in %^&^*%*&^% Git.:

    Many modern languages, such as Java and C#, do not have such a concept.

    Yeah, because it's only a global variable if you don't need a dot to access it. Static variables are completely different and bear no similarity to globals whatsoever.

    @blakeyrat said in %^&^*%*&^% Git.:

    @Gąska said in %^&^*%*&^% Git.:

    I mean, yes, Git did get this wrong.

    Wow you admit that. Amazing.

    Why? I hate Git as much as the next person.

    @Gąska said in %^&^*%*&^% Git.:

    But insisting "global" implies something globe-shaped,

    it does though.

    Just like "mouse" implies an animal.



  • @Gąska said in %^&^*%*&^% Git.:

    Static variables are completely different and bear no similarity to globals whatsoever.

    Correct.

    I'm sure this was an attempt at sarcasm, but you accidentally typed a correct thing. Congratulations!


  • Considered Harmful

    @blakeyrat wow, your shit must crash a lot. globally mutable statics are just as dangerous as globals, a dot does not comprise sufficient fig-leaf.


  • Banned

    @blakeyrat said in %^&^*%*&^% Git.:

    @Gąska said in %^&^*%*&^% Git.:

    Static variables are completely different and bear no similarity to globals whatsoever.

    Correct.

    :facepalm: I'm outta here.


  • Considered Harmful

    This post is deleted!

  • Considered Harmful

    @blakeyrat said in %^&^*%*&^% Git.:

    I do, but do all expected users of Git do? Many modern languages, such as Java and C#, do not have such a concept. Is Git built only for people who use C?

    Pretty much everyone knows that 'global' means 'accessible anywhere'.



  • @pie_flavor Except the makers of Git.


  • Banned

    @Magus though it is accessible everywhere. I mean, I've never seen Linux user using more than one account. :trollface:


  • Considered Harmful

    @Gąska well I mean root can do everything 🚎



  • @Magus said in %^&^*%*&^% Git.:

    Git absolutely should have an option to not allow popups as a commandline switch.

    Git can't have such option. YOU have configured (as far as Git can tell; Microsoft did it for you) it to run a specific command to get credentials and it has no control over whether that program pops up a window, because it is not possible in Windows. And you can tell it to forget that option, too.

    @Magus said in %^&^*%*&^% Git.:

    If we were using TFS, I guarantee this would not be an issue. At all.

    I would not be so sure. In fact, I am pretty sure there are cases it would be. Because that helper just invokes standard Windows function and so does the TFVC client. It usually only isn't a problem because the account running the build is already authorised, but that is usually the case with the Git backend too.

    @Magus said in %^&^*%*&^% Git.:

    It already has switches for rewriting its own history, which is an anti-feature.

    A bit off-topic. But it does not, and you could do the same thing without those options anyway. You can always create new history, if only by creating a new local repository. But it is a new history, and that is the case with --amend or rebase too: it is a new history. The central repository should be configured not to accept it; all the repository managers can be configured so (and should be for the central branch).


  • Trolleybus Mechanic

    @JBert said in %^&^*%*&^% Git.:

    You are technically correct and yet still missing the target: the git config --local command can only be used after a git clone, but it's exactly the clone step where @Magus needs it.

    actually one could do as sequence of
    git init
    git config --local ...
    git remote add ...
    git fetch ...
    git checkout ...

    thus manually doing what a clone with -c credential.helper= does

    But ofc. this is a workaround and not in any way sane.



  • @Bulb said in %^&^*%*&^% Git.:

    I would not be so sure. In fact, I am pretty sure there are cases it would be. Because that helper just invokes standard Windows function and so does the TFVC client. It usually only isn't a problem because the account running the build is already authorised, but that is usually the case with the Git backend too.

    Yeah, no. Because there would be library access to the source control system, and also generally the nature of TFS repositories, none of the problems I encountered here would happen. At all.



  • @Magus Library access is mostly useless in this case. And there is absolutely no guarantee it would be any help anyway, because the credentials dialog would still be called somewhere deep from the bowels of the update operation, so either you'd configure the credentials ahead of time—which works for Git just as well—or get the dialog. The nature of repositories might help, but that has nothing to do with the backend, but with the configuration of repositories you encountered.



  • @Bulb said in %^&^*%*&^% Git.:

    Library access is mostly useless in this case.

    If I had that, I wouldn't be shell scripting this.



  • @Magus said in %^&^*%*&^% Git.:

    @Bulb said in %^&^*%*&^% Git.:

    Library access is mostly useless in this case.

    If I had that, I wouldn't be shell scripting this.

    You would be powershell-scripting it instead. And? That would make zero difference in whether the library pops up a dialog when it does not find appropriate credentials in the store.



  • @Bulb I don't think you understand at all. I'm using powershell now because it's all I have. Because git has no api, because it was programmed by morons for morons, in a way that requires it to read how to log in from a file instead of providing several methods with clear definitions for you to call what you want.



  • @Magus Git has an API. It is one based on exec, but it is API nonethless. It has a huge advantage that it is language agnostic too.

    It is totally orthogonal to having a clear, documented method to pass the credentials. And I agree that it is poorly documented for Git—the documentation is relatively detailed, but total pain to find anything in.

    And I didn't check TFVC, so maybe they actually do have such well documented methods. From what I've seen, I still wouldn't bet on it though.



  • @Magus said in %^&^*%*&^% Git.:

    If I had [library access]



  • @ben_lubar Yes, the thing that requires luck to stay in sync with something that does not want it to exist. Because git is made by morons.


  • Fake News

    @Bulb said in %^&^*%*&^% Git.:

    @Magus Library access is mostly useless in this case. And there is absolutely no guarantee it would be any help anyway, because the credentials dialog would still be called somewhere deep from the bowels of the update operation, so either you'd configure the credentials ahead of time—which works for Git just as well—or get the dialog. The nature of repositories might help, but that has nothing to do with the backend, but with the configuration of repositories you encountered.

    In this case they thought of that, so I've got this in my PowerShell:

    $oauthCredential = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential($env:SYSTEM_ACCESSTOKEN)
    $tfsCredential = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($oauthCredential)
    $tfsCredential.AllowInteractive = $false
    

    @Magus Sadly that library's documentation seems to have completely dropped off the Internet now, or my Google-fu is letting me down. Even when it could be found the documentation was sparse at best, so having a library is still no guarantee for success.



  • @Magus said in %^&^*%*&^% Git.:

    @ben_lubar Yes, the thing that requires luck to stay in sync with something that does not want it to exist.

    I can't figure out what you're referring to.

    @Magus said in %^&^*%*&^% Git.:

    Because git is made by morons.

    The... entire computing industry?

    0_1534192036932_8790aad0-c95c-4d71-9576-b001579e5f87-image.png



  • @ben_lubar Libgit2. The thing not made by the people who made git and that the people who made git believe should not exist, because git is meant to only be used through commandline. Libgit2 has to play catchup any time git changes, because they have to try to keep compatibility with a system that hates them and changes the commands.



  • @Magus said in %^&^*%*&^% Git.:

    the people who made git

    These people? [official Git mailing list]

    I don't see any hate in there.



  • @ben_lubar You do know torvalds made git, right? The guy who is all hate, all the time?



  • @Magus said in %^&^*%*&^% Git.:

    torvalds made git

    Yes, I'm sure there is exactly one person who has ever worked on one of the largest open source projects in the world.


  • Considered Harmful

    @Bulb said in %^&^*%*&^% Git.:

    It has a huge advantage that it is language agnostic too.

    Language agnostic can suck my dick. Everything under the sun can call a C function, so if you intend for your application to be callable by everything under the sun, make the main API through C and make the CLI command a simple wrapper for the functions.



  • @pie_flavor As if TFS had that.

    Git does. And regarding

    @Magus said in %^&^*%*&^% Git.:

    Libgit2 has to play catchup any time git changes

    No, because Git didn't ever change the repository layout. Some features were added and it may have taken a bit of time to add them to the other implementations too, but they would never break anything.


  • Considered Harmful

    @Bulb said in %^&^*%*&^% Git.:

    Git does.

    No. Third party reimplementation does not count.



  • @pie_flavor given that libgit2, and not the executable version, is what powers most repositories (including github and gitlab) and half of the tools the label third-party is not really appropriate, though it formally is.


  • Considered Harmful

    @Bulb said in %^&^*%*&^% Git.:

    @pie_flavor given that libgit2, and not the executable version, is what powers most repositories (including github and gitlab) and half of the tools the label third-party is not really appropriate, though it formally is.

    The official git repository format includes locations for scripts, which are expected to use git commands. So yeah, it's still tied in there pretty tightly.



  • @Bulb said in %^&^*%*&^% Git.:

    but they would never break anything.

    Pre-commit and post-commit hooks, if they weren't designed SPECIFICALLY TO FUCK OVER GUI BUILDERS, sure as fuck look like they were.


  • Banned

    @blakeyrat they weren't designed. Like, at all. They just happened.



  • @Gąska Well that's true of 90% of Git, isn't it? And also exactly the problem.


  • Discourse touched me in a no-no place

    @ben_lubar said in %^&^*%*&^% Git.:

    Yes, I'm sure there is exactly one person who has ever worked on one of the largest open source projects in the world.

    Part-time, presumably.


Log in to reply