bash - How to check the validity of a remote git repository URL? -
within bash script, simplest way verify git url points valid git repo , script has access read it?
protocols should supported git@
, https://
, , git://
. curl fails on git://
protocol.
git@github.com:username/example.git https://username@github.com/username/example.git git://github.com/username/example.git
note: i'm not asking check see if url syntactically correct, need verify repo exists @ url location entered within bash script.
as seen in this issue, can use git ls-remote test address.
if need debug git calls
set git_trace=1
. eg:
env git_proxy_commadn=myproxy.sh git_trace=1 git ls-remote https://...
"
git ls-remote
" quickest way know test communications remote repository without cloning it. hence utility test issue.
you can see used detecting address issue in "git ls-remote
returns 128 on repo".
Comments
Post a Comment