diff --git a/lib/gitlab/gitolite.rb b/lib/gitlab/gitolite.rb
index efb89165b476f1c5ec5a31f8ba86a24eb2d10971..5fb50f854c2d962eb048f6c0ccd98d0065813c0c 100644
--- a/lib/gitlab/gitolite.rb
+++ b/lib/gitlab/gitolite.rb
@@ -106,13 +106,13 @@ module Gitlab
       name_writers = project.repository_writers
       name_masters = project.repository_masters
 
-      pr_br = project.protected_branches.map(&:name).join(" ")
+      pr_br = project.protected_branches.map(&:name).join("$ ")
 
       repo.clean_permissions
 
       # Deny access to protected branches for writers
       unless name_writers.blank? || pr_br.blank?
-        repo.add_permission("-", pr_br, name_writers)
+        repo.add_permission("-", pr_br.strip + "$ ", name_writers)
       end
 
       # Add read permissions