diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb
index e9be0ac3263843881da36a708c0affba1a300903..2e6695f4f45db23bbc955401c53a3171f74c791b 100644
--- a/Library/Homebrew/utils/github.rb
+++ b/Library/Homebrew/utils/github.rb
@@ -341,8 +341,8 @@ module GitHub
   end
 
   def check_fork_exists(repo)
-    username = api_credentials[1]
-    reponame = repo.split("/")[1]
+    _, username = api_credentials
+    _, reponame = repo.split("/")
     json = open_api(url_to("repos", username, reponame))
     return false if json["message"] == "Not Found"