diff --git a/modules/context/repo.go b/modules/context/repo.go index 1742683d3cf1d..1a0263a3307a1 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -451,11 +451,20 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { owner, err = user_model.GetUserByName(ctx, userName) if err != nil { if user_model.IsErrUserNotExist(err) { + // go-get does not support redirects + // https://github.com/golang/go/issues/19760 if ctx.FormString("go-get") == "1" { EarlyResponseForGoGetMeta(ctx) return } - ctx.NotFound("GetUserByName", nil) + + if redirectUserID, err := user_model.LookupUserRedirect(userName); err == nil { + RedirectToUser(ctx, userName, redirectUserID) + } else if user_model.IsErrUserRedirectNotExist(err) { + ctx.NotFound("GetUserByName", nil) + } else { + ctx.ServerError("LookupUserRedirect", err) + } } else { ctx.ServerError("GetUserByName", err) }