diff --git a/services/context/repo.go b/services/context/repo.go index f79ab39cc74..61ffbb22f79 100644 --- a/services/context/repo.go +++ b/services/context/repo.go @@ -695,6 +695,12 @@ func repoAssignmentPrepareGitRepo(ctx *Context, data *repoAssignmentPrepareDataS ctx.Repo.GitRepo, err = git.RepositoryFromRequestContextOrOpen(ctx, repo) if err != nil { if strings.Contains(err.Error(), "repository does not exist") || strings.Contains(err.Error(), "no such file or directory") { + // A repository that is still being created (migrated or forked) does not have its + // git data on disk yet, so opening it fails. This is expected and must not be + // treated as a permanently broken repository. + if ctx.Repo.Repository.IsBeingCreated() { + return + } log.Error("Repository %-v has a broken repository on the file system: %s Error: %v", ctx.Repo.Repository, ctx.Repo.Repository.FullName(), err) ctx.Repo.Repository.MarkAsBrokenEmpty() // Only allow access to base of repo or settings