diff --git a/routers/private/serv.go b/routers/private/serv.go index 3367959ac6b..5fcb9da4142 100644 --- a/routers/private/serv.go +++ b/routers/private/serv.go @@ -282,7 +282,7 @@ func ServCommand(ctx *context.PrivateContext) { (mode > models.AccessModeRead || repo.IsPrivate || owner.Visibility.IsPrivate() || - user.IsRestricted || + (user != nil && user.IsRestricted) || // user will be nil if the key is a deploykey setting.Service.RequireSignInView) { if key.Type == models.KeyTypeDeploy { if deployKey.Mode < mode {