From cbee0bd2ee617531103b4f179231824aee9838a3 Mon Sep 17 00:00:00 2001 From: Stafford Brunk Date: Mon, 14 May 2012 16:18:24 -0600 Subject: [PATCH] Print an appropriate message if the tapped repository appears to be private Closes Homebrew/homebrew#12247. Closes Homebrew/homebrew#12244. Signed-off-by: Max Howell --- Library/Homebrew/cmd/tap.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index bdcc8369ef..ee083eb00c 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -29,6 +29,22 @@ module Homebrew extend self tapd.find_formula{ |file| files << tapd.basename.join(file) } tapped = link_tap_formula(files) puts "Tapped #{tapped} formula" + + # Figure out if this repo is private + # curl will throw an exception if the repo is private (Github returns a 404) + begin + curl('-Ifso', '/dev/null', "https://api.github.com/repos/#{repouser}/homebrew-#{repo}") + rescue + puts + puts "It looks like you tapped a private repository" + puts "In order to not input your credentials every time" + puts "you can use git HTTP credential caching or issue the" + puts "following command:" + puts + puts " cd #{tapd}" + puts " git remote set-url origin git@github.com:#{repouser}/homebrew-#{repo}.git" + puts + end end def link_tap_formula formulae