abpframework/abp · error · Exception
Remote origin is null for given repository !
Error message
Remote origin is null for given repository !
What it means
Thrown by GetRepositoryNameFromRepositoryInfo when the opened LibGit2Sharp Repository has no remote named 'origin'. The reader derives the repository name from the origin remote URL; without an origin remote there is nothing to parse, so it aborts.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/FileSystemDotNetProjectBuildConfigReader.cs:99
var repositoryName = GetRepositoryNameFromRepositoryInfo(repo);
return new GitRepository(repositoryName, repo.Head.FriendlyName, directoryInfo.FullName);
}
}
directoryInfo = directoryInfo.Parent;
} while (directoryInfo?.Parent != null);
throw new Exception("There is no solution file (*.sln or *.slnx) and " + _buildConfigName +
" in the working directory and working directory is not a GIT repository !");
}
private string GetRepositoryNameFromRepositoryInfo(Repository repository)
{
var remote = repository.Network.Remotes.FirstOrDefault(r => r.Name == "origin");
if (remote == null)
{
throw new Exception("Remote origin is null for given repository !");
}
var remoteUrl = remote.Url;
remoteUrl = Regex.Replace(remoteUrl, @"\.git$", "");
remoteUrl = Regex.Replace(remoteUrl, "^git@", "https://");
remoteUrl = Regex.Replace(remoteUrl, "^https:git@", "https://");
remoteUrl = Regex.Replace(remoteUrl, ".com:", ".com/");
var remoteUri = new Uri(remoteUrl);
var pathSegments = remoteUri.AbsolutePath.Split("/", StringSplitOptions.RemoveEmptyEntries);
if (pathSegments != null && pathSegments.Length >= 2)
{
var repo = pathSegments[1];
return repo;
}View on GitHub (pinned to 7ed43b1931)
Solutions
- Add an origin remote: git remote add origin <your-remote-url>.
- If the remote exists under a different name, rename it: git remote rename <current> origin.
- Verify with 'git remote -v' that origin is present before running the ABP build.
- Alternatively, supply an abp-build-config.json so the reader does not need to infer the repo from git.
Example fix
# before: no origin remote abp build # throws: Remote origin is null git remote -v # (empty or no origin) # after: add origin git remote add origin https://github.com/org/myrepo.git abp build
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check: the repository must have an 'origin' remote.
using var repo = new Repository(repoPath);
if (repo.Network.Remotes.FirstOrDefault(r => r.Name == "origin") == null)
{
throw new InvalidOperationException("No 'origin' remote configured. Run: git remote add origin <url>");
} Type guard
public static bool HasOriginRemote(Repository repo) =>
repo.Network.Remotes.Any(r => r.Name == "origin"); Try / catch
try
{
var cfg = reader.Read(directoryPath);
}
catch (Exception ex) when (ex.Message.Contains("Remote origin is null", StringComparison.Ordinal))
{
logger.LogError(ex, "Missing 'origin' remote; add one before building.");
throw;
} Prevention
- Always add an 'origin' remote when initializing repos that will be built with the ABP CLI.
- Verify 'git remote -v' shows origin before running 'abp build'.
- If renaming remotes, keep 'origin' as the canonical name.
- Provide an abp-build-config.json so git inference is not required.
When it happens
Trigger: A .git folder was found and opened, but repository.Network.Remotes contains no entry whose Name == 'origin'. Happens with local-only repos that never had a remote added, or repos whose remote was renamed or removed.
Common situations: git init'd a project locally without ever adding a remote; the remote was named something other than 'origin' (e.g., 'upstream' or a custom name); a CI clone configured a differently-named remote; the repo was created by a tool that does not set origin.
Related errors
- There is no solution file (*.sln or *.slnx) and {_buildConfi
- Couldn't find repository name using remote origin url !
- There are more than 1 config (abp-build-config.json) file in
- Cyclic dependency found! Item: {item}
- Build failed!
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/97753eb3d083b34e.
Report an issue: GitHub.