From 463da9d24cae087b0ee1330acc45e75ad843930b Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 22 Mar 2013 17:58:00 -0700 Subject: [PATCH] Forbid users to push "root" repositories --- storage/commands.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/commands.go b/storage/commands.go index 0de3c77c39..14ebe47b58 100644 --- a/storage/commands.go +++ b/storage/commands.go @@ -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 / (ex: %s/%s)", + srv.runtime.authConfig.Username, local) } else { remote = local }