laurent22/joplin · error · Error

Your local commit has not been pushed to GitHub. Run git pus

Error message

Your local commit has not been pushed to GitHub. Run git push then try publishing again.

What it means

Thrown by verifyGitState as the final check: the remote HEAD SHA (from git ls-remote) differs from the local HEAD SHA (from git rev-parse HEAD). This means the local commit being published has not been pushed to the remote, so the published plugin would reference a commit no one else can fetch. Publish is blocked until local and remote are in sync.

Source

Thrown at packages/generator-joplin/generators/app/templates/script/publish/steps/verifyGitState.ts:63

	}

	const remoteHeadLine = await runGit(`git ls-remote origin ${currentBranch}`, 'Could not retrieve remote HEAD. Make sure you have pushed your changes and have an internet connection.');
	if (!remoteHeadLine) {
		throw new Error('Remote HEAD is empty. Make sure you have pushed your changes.');
	}

	const parts = remoteHeadLine.split('\n')[0].split(/\s+/);
	if (parts.length < 2) {
		throw new Error(`Unexpected git ls-remote output: "${remoteHeadLine}". Make sure your git remote and branch are configured correctly.`);
	}

	const remoteHash = parts[0];
	if (remoteHash.length !== 40) {
		throw new Error('Failed to extract a valid remote commit hash.');
	}

	if (remoteHash !== commitHash) {
		throw new Error('Your local commit has not been pushed to GitHub. Run git push then try publishing again.');
	}
	logger.success('Local commit is synced with remote.');

	return commitHash;
};

export default verifyGitState;

View on GitHub (pinned to 2654b33620)

Solutions

  1. Push the local commit: git push origin <branch>, then re-run publish.
  2. If the remote diverged, rebase or merge first: git pull --rebase origin <branch> && git push.
  3. Confirm sync: git rev-parse HEAD should equal git ls-remote origin <branch>.

Example fix

# before
git commit -m 'release 1.1.0'
 npm run publish
# after
git commit -m 'release 1.1.0' && git push origin main
 npm run publish
Defensive patterns

Strategy: validation

Validate before calling

const local = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
const remote = execSync(`git ls-remote origin ${branch}`, { encoding: 'utf8' }).trim().split(/\s+/)[0];
if (local !== remote) {
  throw new Error('Local not pushed. Run: git push origin ' + branch);
}

Type guard

function isInSync(local, remote) { return local === remote; }

Prevention

When it happens

Trigger: The user committed locally but did not push; the user pushed an older commit and then committed again; the remote was force-pushed by someone else diverging the history; local has uncommitted-then-amended changes not yet pushed.

Common situations: Developer runs `npm run publish` right after `git commit` forgetting `git push`; a post-commit hook or amend created a new SHA not yet on the remote; collaborator force-pushed the branch.

Related errors


AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12). Data as JSON: /api/errors/f972c0660a3813ea. Report an issue: GitHub.