[ACCEPTED]-How to run git commands on remote without having local repo-export
You're looking for git ls-remote
. For example:
$ git ls-remote git://git.kernel.org/pub/scm/git/git.git
4d8b32a2e1758236c4c1b714f179892e3bce982c HEAD
f75a94048af9e423a3d8cba694531d0d08bd82b4 refs/heads/html
810cae53e0f622d6804f063c04a83dbc3a11b7ca refs/heads/maint
70b5eebd65f2d47fd69073aed1d3da0f1fd7a017 refs/heads/man
4d8b32a2e1758236c4c1b714f179892e3bce982c refs/heads/master
b9f1b13437fd0b8b1857ffbdebb9e1adc50481f0 refs/heads/next
83a9d3226b19a683a9a783bde0784c2caf19e9a1 refs/heads/pu
2309986900ed1a5744b3a81c507943593000ce32 refs/heads/todo
d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0
3d654be48f65545c4d3e35f5d3bbed5489820930 refs/tags/gitgui-0.10.0^{}
33682a5e98adfd8ba4ce0e21363c443bd273eb77 refs/tags/gitgui-0.10.1
729ffa50f75a025935623bfc58d0932c65f7de2f refs/tags/gitgui-0.10.1^{}
...
(git.git has a lot of tags!)
You can 13 limit yourself to branches with the --heads
option 12 or tags with the --tags
option, or specify a pattern 11 to select refs, for example to see only 10 the git version tags from git.git, git ls-remote <url> refs/tags/v*
. Or 9 you might already know exactly what ref 8 you want: git ls-remote <url> HEAD
.
You can't run arbitrary commands 7 on arbitrary remotes, though. The transfer 6 protocols don't support that - they're designed 5 to support listing refs and transferring 4 objects (via packs). In particular, you 3 won't be able to do anything analogous to 2 rev-list
. You'll be limited to getting SHA1s for 1 commits pointed to by refs.
You can use curl for checking if the specific 3 url exists or not for example when i try 2 to hit angularjs existing url
$ curl -I https://github.com/angular/angularjs.org/tree/master/src
**HTTP/1.1 200 OK**
Server: GitHub.com
Date: Mon, 11 Aug 2014 15:22:40 GMT
When I hit 1 on a wrong URL
$ curl -I https://github.com/angular/angularjs.org/tree/master/abcd
**HTTP/1.1 404 Not Found**
Server: GitHub.com
Date: Mon, 11 Aug 2014 15:24:06 GMT
Hope this helps
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.