diff --git a/src/commands/link/index.ts b/src/commands/link/index.ts index bc12cb2..7d1b371 100644 --- a/src/commands/link/index.ts +++ b/src/commands/link/index.ts @@ -104,7 +104,7 @@ export default class LinkIndex extends Command { const gitConfigFilePath = getGitConfigFilePath() if (!fileExists(gitConfigFilePath)) { - throw new Error('No remote git repository found') + throw new Error(chalk.red('No .git found in this directory. Please initialize a git repository with `git init`.')) } const gitUrl = getGitRemoteUrl(gitConfigFilePath) diff --git a/src/util/index.ts b/src/util/index.ts index 838baf4..9ebf2f5 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -114,7 +114,7 @@ export function getGitRemoteUrl(filePath: string): string { const content = fs.readFileSync(filePath, 'utf8') const remoteMatch = content.match(/\[remote "origin"]\n\s+url = (.*)/) if (!remoteMatch) { - throw new Error('No remote origin found in .git/config') + throw new Error(chalk.red('No remote origin found in .git/config, please set up a remote origin with `git remote add origin `.')) } return remoteMatch[1]