Path Copy

Copy the right file path or Git repository URL without leaving VS Code.
Path Copy adds an IntelliJ-style copy picker to the Explorer and editor tabs. See the exact value before copying an absolute path, workspace path, repository path, Markdown link, permanent Git link, file name, or repository URL.
日本語版 · Report an issue · Source code
Why Path Copy?
- Choose the right reference every time — see the value beside each copy option before you copy it.
- Share code locations faster — copy a path or repository URL directly from a file or folder's context menu.
- Works with real project layouts — resolves the selected item's workspace folder and nearest Git repository, including multi-root workspaces.
- No account or network access required — paths and Git remotes are read locally; the extension has no telemetry.
Get started
- Install Path Copy from the VS Code Marketplace.
- Right-click a file or folder in the Explorer, or right-click an editor tab.
- Select Copy Path or Repository URL….
- Choose the value you need. It is copied immediately.
Long values are shortened in the picker. Hover the information icon on the right of an option to see its complete value; clicking the icon copies it too.
What can I copy?
| Copy option |
Useful when you need… |
| Absolute Path |
a local path for a terminal command, script, or operating-system dialog |
| File Name |
just the selected file or folder name |
| Code Position |
a path, one-based line, and one-based column such as src/extension.js:12:4 from the active editor |
| Path Relative to Content Root |
a path from the current VS Code workspace folder |
| Path Relative to Repository Root |
a stable project-relative reference for documentation, issues, or reviews |
| Relative Paths (Multiple Selection) |
newline-delimited paths, a JSON array, or a Markdown list for several Explorer items |
| Markdown Link |
a ready-to-paste relative link for a README, issue, or review |
| Repository URL |
a link to the selected item's Git repository |
| Permanent Git Link |
a GitHub or GitLab link pinned to the current commit, including selected editor lines when available |
Git-related options use the nearest repository containing the selected item. Markdown links use that repository-relative path when available, otherwise the selected item's workspace-relative path. Permanent Git links use the current commit SHA, so they remain stable when branches move. In multi-root workspaces, Path Copy uses the selected item's own workspace folder.
Code positions use the active editor's cursor position. Their path is repository-relative when possible, otherwise workspace-relative; files outside a workspace use an absolute path.
When several files or folders are selected in the Explorer, Copy Path or Repository URL… offers the three batch formats. You can also choose the corresponding direct command from the context menu.
By default, SSH remotes such as git@github.com:owner/repository.git become shareable browser URLs such as https://github.com/owner/repository.
To copy the configured Git remote without changing it:
{
"pathCopy.remoteUrlFormat": "preserve"
}
To use a remote other than origin:
{
"pathCopy.remoteName": "upstream"
}
If a Git operation fails, Path Copy reports whether Git could not start, access was denied, the selected item is outside a repository, or the configured remote is missing.
Custom copy templates
Add pathCopy.copyTemplates to your settings to show your own entries in the copy picker. For example, this creates a GitHub permalink using the current commit and cursor line:
{
"pathCopy.copyTemplates": [
{
"name": "GitHub permalink",
"template": "${repoUrl}/blob/${commit}/${path}#L${line}"
}
]
}
Supported variables are ${absolutePath}, ${fileName}, ${path}, ${workspacePath}, ${repositoryPath}, ${repoUrl}, ${commit}, ${line}, and ${endLine}. ${path} is repository-relative when Git is available, otherwise workspace-relative. ${line} is the cursor or first selected line, and ${endLine} is available only for a multi-line editor selection. Templates that need unavailable information are hidden; unknown variables remain unchanged.
Languages
Path Copy follows your VS Code display language. English is the default, with Japanese, Simplified Chinese, Korean, French, German, Spanish, and Brazilian Portuguese included.
Requirements
- VS Code 1.85 or later
- Git is required only for repository-relative paths, repository URLs, and permanent Git links
Contributing and support
Bug reports and feature requests are welcome in the issue tracker. See the repository for local development and packaging instructions.
License
MIT