diff --git a/app/services/git/providers/github.rb b/app/services/git/providers/github.rb
index f3bdc6107005f1b34c65b12dffa39c10ca4326b9..2bf52bf8daeb540eb6c3cab79bef8f5e1eb3a8c3 100644
--- a/app/services/git/providers/github.rb
+++ b/app/services/git/providers/github.rb
@@ -75,7 +75,8 @@ class Git::Providers::Github < Git::Providers::Abstract
   end
 
   def default_branch
-    @default_branch ||= branch || client.repo(repository)[:default_branch]
+    @default_branch ||= branch.present? ? branch
+                                        : client.repo(repository)[:default_branch]
   end
 
   def branch_sha