Available within VS Code and Cursor.
Please file an issue for bugs or feature requests. Thanks!
VS Code Extension Marketplace entry here.
Copy a GitHub URL of your current file location to the clipboard. Works for both text files (with line numbers) and non-text files like images, PDFs, and other binary files (without line numbers).
Usage: Ctrl+L C
(same on all platforms)
For all file types (text and non-text), you can:
- Use the keyboard shortcut while the file is open and active (
Ctrl+L C
) - Right-click the file in the Explorer panel and select "Copy GitHub URL" from the context menu
Example (text file): https://github.com/differentmatt/vscode-copy-github-url/blob/example-branch/extension.js#L4
Example (image file): https://github.com/differentmatt/vscode-copy-github-url/blob/example-branch/images/icon.png
Copy a GitHub Permanent URL of your current file location to the clipboard. Works for both text files (with line numbers) and non-text files like images (without line numbers).
Usage: Ctrl+Shift+L C
(same on all platforms)
The same context menu options are available in the Explorer panel for this command.
Example (text file): https://github.com/differentmatt/vscode-copy-github-url/blob/c49dae32/extension.js#L4
Example (image file): https://github.com/differentmatt/vscode-copy-github-url/blob/c49dae32/images/icon.png
Copy a GitHub default branch URL of your current file location to the clipboard. Works for both text files (with line numbers) and non-text files like images (without line numbers).
Usage: Ctrl+Shift+L M
(same on all platforms)
The same context menu options are available in the Explorer panel for this command.
Example (text file): https://github.com/differentmatt/vscode-copy-github-url/blob/main/extension.js#L4
Example (image file): https://github.com/differentmatt/vscode-copy-github-url/blob/main/images/icon.png
- Within Visual Studio Code, open the command palette (
Ctrl-Shift-P
/Cmd-Shift-P
) - Type
install extension
and search forcopy github url
This extension collects anonymous telemetry data to help improve the extension's functionality.
You can disable telemetry collection by setting telemetry.telemetryLevel
to off
in VS Code settings.
No personal or repository-identifying information is collected.
If you encounter an error like "Failed to copy GitHub URL. Error: No active file found" when trying to copy a URL for non-text files (like images, PDFs, or binary files), try the following:
- Make sure the file is open and is the active tab in VS Code
- Right-click the file in the Explorer panel instead and use the context menu
- Use the keyboard shortcut (
Ctrl+L C
) while the non-text file is the active tab - Try using the "Debug Copy GitHub URL (Non-text files)" command from the command palette to diagnose the issue
- If the issue persists, please file an issue with the debug information
Note: The keyboard shortcuts may sometimes not work for non-text files depending on your VS Code configuration. The Explorer context menu is the most reliable method.
-
Keyboard shortcuts for non-text files: While we've improved support for keyboard shortcuts with non-text files, they may not work in all VS Code configurations. Using the Explorer context menu is the most reliable method.
-
Git repository detection: For files outside the current workspace's Git repository, you may need to configure the
copyGithubUrl.rootGitFolder
setting to point to the correct Git repository location.