{"thread":{"id":"50689","subject":"ls-remote set timeout","startedAt":"2019-03-08T09:31:06Z","lastAt":"2019-03-18T02:34:27Z","messageCount":3,"participants":["Jakobus Schürz","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"370947","messageId":"0MUoma-1haJEB1Ckm-00Y6Wl@mail.gmx.com","threadId":"50689","inReplyTo":null,"subject":"ls-remote set timeout","fromName":"Jakobus Schürz","fromEmail":"wertstoffe@nurfuerspam.de","sentAt":"2019-03-08T09:31:01Z","receivedAt":"2019-03-08T09:31:06Z","isPatch":false,"sender":{"key":"wertstoffe@nurfuerspam.de","avatar":null},"body":"Hi there!\n\nIm new to this list - so hello, hope I'm welcome.\n\n\nMy problem is: I have a configuration for my bash saved on a private\ngit-repo. Every time, i start bash, my .bashrc checks this repo out to\nget all changes (alias, some functions, $PS1 and so on). So i can have\nmy working environment on all my servers with personal login.\n\n\nNow I'm working on a new customer, where github.com is not reachable\n(firewall/proxy). Parts of my configuration (some plugins/scripts for\nvim) cannot be updated there, because they are hosted on github.com. :-/\n\nNow i tried to fiddle in a check, if a repo is reachable in my .bashrc.\nAnd i found out, that git ls-remote is a good choice, because it handles\nredirections from http to https correctly behind this proxy. (direct\nhttps links to git-repos do even not work in this surrounding... don't\nask why, please).\n\nI can check, if my private repo (git bare repo with gitweb) is reachable\n(http pull, ssh is also closed!!!) with git ls-remote. But this check\nhangs on github.com in case of a redirection from the proxy to a \"this\nis forbidden\"-site... . And it hangs forever (1 Minute, 2 Minutes or\neven really forever!)\n\nIs it possible, to include a \"--connection-timeout\" and/or the\n\"--max-time\" option for curl, that i can give to my \"git ls-remote\"\ncommand? So i can call\n\ngit --connection-timeout 3 -m 3 ls-remote <REPOURL>\n\nand the command stops after 3 seconds with an errorcode, which I can\nevaluate?\n\nI tried netcat and curl directly. In this environment only git ls-remote\nwill work correctly on reachable repos, but it hangs on blocked... :-/\n\n\nThank you for your interests\n\n\nJakob\n\n\n"},{"id":"371473","messageId":"0Mey7N-1hOXHn3kBF-00OYB8@mail.gmx.com","threadId":"50689","inReplyTo":"0MUoma-1haJEB1Ckm-00Y6Wl@mail.gmx.com","subject":"Re: ls-remote set timeout","fromName":"Jakobus Schürz","fromEmail":"wertstoffe@nurfuerspam.de","sentAt":"2019-03-14T09:38:01Z","receivedAt":"2019-03-14T09:38:05Z","isPatch":false,"sender":{"key":"wertstoffe@nurfuerspam.de","avatar":null},"body":"ping!\n\nDoes anyone has an idea?\n\n\nJakob\n\nAm 08.03.19 um 10:31 schrieb Jakobus Schürz:\n> Hi there!\n>\n> Im new to this list - so hello, hope I'm welcome.\n>\n>\n> My problem is: I have a configuration for my bash saved on a private\n> git-repo. Every time, i start bash, my .bashrc checks this repo out to\n> get all changes (alias, some functions, $PS1 and so on). So i can have\n> my working environment on all my servers with personal login.\n>\n>\n> Now I'm working on a new customer, where github.com is not reachable\n> (firewall/proxy). Parts of my configuration (some plugins/scripts for\n> vim) cannot be updated there, because they are hosted on github.com. :-/\n>\n> Now i tried to fiddle in a check, if a repo is reachable in my .bashrc.\n> And i found out, that git ls-remote is a good choice, because it handles\n> redirections from http to https correctly behind this proxy. (direct\n> https links to git-repos do even not work in this surrounding... don't\n> ask why, please).\n>\n> I can check, if my private repo (git bare repo with gitweb) is reachable\n> (http pull, ssh is also closed!!!) with git ls-remote. But this check\n> hangs on github.com in case of a redirection from the proxy to a \"this\n> is forbidden\"-site... . And it hangs forever (1 Minute, 2 Minutes or\n> even really forever!)\n>\n> Is it possible, to include a \"--connection-timeout\" and/or the\n> \"--max-time\" option for curl, that i can give to my \"git ls-remote\"\n> command? So i can call\n>\n> git --connection-timeout 3 -m 3 ls-remote <REPOURL>\n>\n> and the command stops after 3 seconds with an errorcode, which I can\n> evaluate?\n>\n> I tried netcat and curl directly. In this environment only git ls-remote\n> will work correctly on reachable repos, but it hangs on blocked... :-/\n>\n>\n> Thank you for your interests\n>\n>\n> Jakob\n>\n>\n"},{"id":"371764","messageId":"xmqqbm287vwx.fsf@gitster-ct.c.googlers.com","threadId":"50689","inReplyTo":"0Mey7N-1hOXHn3kBF-00OYB8@mail.gmx.com","subject":"Re: ls-remote set timeout","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-03-18T02:34:22Z","receivedAt":"2019-03-18T02:34:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakobus Schürz <wertstoffe@nurfuerspam.de> writes:\n\n> Does anyone has an idea?\n\nLack of response generally indicate that people are not interested\nbut the reason why they are not varies.  It may be because you did\nnot give them sufficient information about your situation (are you\ntrying to do this on Windows, for example?).  It may be because you\nare looking for a solution that applies only to a narrow situation\nthat they are not interested in, but by stepping back a bit and by\ncoming up with a solution that may apply to more general problem may\npique their interest.\n\nInstead of patching \"git\" to tell it what the connection timeout is,\nperhaps a more general command that runs anything and aborts it if\nit does not finish within given time period, e.g.\n\n\ttimeout 180 git ls-remote <REMOTE>\n\nmay run \"git ls-remote <REMOTE>\" but kill it if it does not finish\nwithin 180 seconds.\n\nIf you wrote such a general purpose command, that would help you\nrunning ls-remote and abort it if it does not finish within the\ngiven timeout, and also help others who are not using Git but with a\nsimilar need to run other things and kill them when they run for too\nlong.\n\nWho knows.  If you look for such a command, you might find that one\nalready exists.  http://lmgtfy.com/?q=run+linux+command+with+timeout\n"}]}