Safely Unpin a GitHub Issue with gh issue unpin
You will remove one issue from a GitHub repository's pinned issues and verify that it is no longer pinned. The command is part of GitHub CLI 2.87.3, the version installed on this machine, and it accepts either an issue number or a complete issue URL.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about five minutes. You need the gh command, an authenticated GitHub CLI session, access to the target repository, and an issue that is currently pinned. This operation changes repository metadata on GitHub, but it does not edit the issue body, comments, labels or code. It does not need sudo.
1. Check the installed command
Begin with a read-only check so that the syntax you use matches the installed binary:
$ gh --version
gh version 2.87.3 (2026-02-23)
$ gh issue unpin --help
The command shape is gh issue unpin {<number> | <url>} [flags]. The only option specific to repository selection is the inherited -R or --repo flag. The help text should show the same number-or-URL form before you continue.
Checkpoint
If gh issue unpin --help fails, stop here. Fix the local CLI installation or your PATH rather than trying a similar-looking command from memory.
2. Confirm the repository and issue state
Do not unpin by number until you know which repository gh will use. From a checked-out repository, inspect its remote:
$ git remote get-url origin
https://github.com/OWNER/REPOSITORY.git
Replace OWNER, REPOSITORY and ISSUE_NUMBER below with the real values. The following read-only query confirms the issue identity and current pin state:
$ gh issue view ISSUE_NUMBER --repo OWNER/REPOSITORY --json number,title,isPinned,url
{
"isPinned": true,
"number": ISSUE_NUMBER,
"title": "Your issue title",
"url": "https://github.com/OWNER/REPOSITORY/issues/ISSUE_NUMBER"
}
The exact title and URL will differ. If isPinned is already false, there is nothing to remove. If the number identifies a different issue than expected, stop and correct the repository or number before changing anything.
A repository-relative number is safe only when the repository context is unambiguous. An issue URL is often clearer when you are working across several repositories or hosts.
3. Unpin by issue number
With the repository and state confirmed, run the mutation explicitly against that repository:
$ gh issue unpin ISSUE_NUMBER --repo OWNER/REPOSITORY
$ printf 'exit status: %s\n' "$?"
exit status: 0
The command has no output contract in the manpage, so use the exit status rather than looking for a particular success sentence. Status 0 means the CLI completed the request. A non-zero status means the operation did not complete successfully; do not assume that the issue changed.
There is no elevated-privilege version of this command. GitHub authorisation and repository permissions are checked by GitHub, not by sudo. Do not put a token directly in the command line or paste one into a shell history.
4. Verify the change
Query the same issue again, using the same explicit repository:
$ gh issue view ISSUE_NUMBER --repo OWNER/REPOSITORY --json number,title,isPinned,url
{
"isPinned": false,
"number": ISSUE_NUMBER,
"title": "Your issue title",
"url": "https://github.com/OWNER/REPOSITORY/issues/ISSUE_NUMBER"
}
The important field is isPinned. The issue itself still exists, and this operation does not close it or remove any discussion. If the field remains true, check that you used the same owner, repository and issue number, then inspect the command's error output and authentication state.
Checkpoint
Stop when the returned URL and number match your intended issue and isPinned is false. Keep this output in the change record if the unpin was part of a release or moderation task.
5. Use a URL when context is easy to lose
The URL form removes ambiguity about the repository and issue:
$ gh issue unpin https://github.com/OWNER/REPOSITORY/issues/ISSUE_NUMBER
Use the full URL copied from the issue page, and review it before pressing Enter. A URL for another repository is still a valid target, so it is not a substitute for checking the owner and repository. For a GitHub Enterprise host, use that host's issue URL; the local command syntax also permits a host-qualified repository with --repo.
6. Recover from a mistake
Unpinning is reversible, but the undo action is another repository change. If you removed the wrong pin, confirm the issue URL first, then restore it with the matching pin command:
$ gh issue pin ISSUE_NUMBER --repo OWNER/REPOSITORY
$ gh issue view ISSUE_NUMBER --repo OWNER/REPOSITORY --json number,isPinned,url
{
"isPinned": true,
"number": ISSUE_NUMBER,
"url": "https://github.com/OWNER/REPOSITORY/issues/ISSUE_NUMBER"
}
Do not run the recovery command as a blind retry. First establish whether the original unpin succeeded. Repeating a state-changing command can make an audit trail harder to interpret, especially when several people are maintaining the repository.
Common failure points
- Wrong repository: a number such as
23is meaningful only within its repository. Add--repo OWNER/REPOSITORYor use the complete URL. - Already unpinned: verify
isPinnedbefore changing anything. There is no useful second removal to perform. - Not authenticated: run the read-only checks first and resolve the GitHub CLI login problem through your normal account process. Do not expose credentials in shell arguments.
- Insufficient permission: a valid issue URL does not grant permission to change repository pins. Ask a repository administrator or maintainer to perform the operation when GitHub rejects the request.
- Unclear result: preserve the error, then repeat the read-only
gh issue viewquery. Treat the reported state as authoritative before attempting an undo.
Done means
- The installed
gh issue unpinsyntax was checked. - The owner, repository, issue number and issue URL were confirmed.
- The unpin command returned exit status 0.
- A second issue query reported
isPinned: false. - No issue content, comments, labels or source files were changed.