← All examples

Action Productivity github.com

Copy the repository clone URL

Builds the HTTPS git clone URL of the current repository and copies it to the clipboard.

Code to copy

// Copy the repository git clone URL to the clipboard
var path = location.pathname.split('/').filter(Boolean).slice(0, 2).join('/');
if (path.split('/').length === 2) {
  var url = 'https://github.com/' + path + '.git';
  navigator.clipboard.writeText(url);
  JZ.toast('Copied: ' + url);
} else {
  JZ.toast('Open a repository first');
}

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Enable the action panel, add a button in the Actions tab and paste the code into it — run it with one click.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases