Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Git - check file exist on online repository
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Fulgurance
Veteran
Veteran


Joined: 15 Feb 2017
Posts: 1200

PostPosted: Thu Feb 08, 2018 2:02 pm    Post subject: Git - check file exist on online repository Reply with quote

Hello, can you know with git cli how to check if file exist on git online repository ? (public repository)
Back to top
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1791

PostPosted: Thu Feb 08, 2018 5:30 pm    Post subject: Reply with quote

You may want to look at this:
https://stackoverflow.com/questions/4135049/how-do-i-check-if-a-file-exists-in-a-remote
Back to top
View user's profile Send private message
richardfullers
n00b
n00b


Joined: 11 Feb 2018
Posts: 1

PostPosted: Mon Feb 12, 2018 1:20 pm    Post subject: This command may be helpful. Reply with quote

function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Tue Feb 13, 2018 12:49 pm    Post subject: Re: This command may be helpful. Reply with quote

richardfullers wrote:
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}

Useless use of grep.

Code:
wget -q -O /dev/null https://[RAW-FILE-URL] && echo "Success"

Code:
wget -q -O /dev/null https://[RAW-FILE-URL] || echo "Failed"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum