Forbid users to push "root" repositories

Upstream-commit: b370acd679622239849b1dfbe05d61804aeb7162
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-03-22 17:58:00 -07:00
parent f375f50cbd
commit 1a02694099
+3 -1
View File
@@ -420,7 +420,9 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string
tmp := strings.SplitN(local, "/", 2)
if len(tmp) == 1 {
remote = srv.runtime.authConfig.Username + "/" + local
return fmt.Errorf(
"Impossible to push a \"root\" repository. Please rename your repository in <user>/<repo> (ex: %s/%s)",
srv.runtime.authConfig.Username, local)
} else {
remote = local
}