// ==UserScript==
// @name GitHub Full Clone Command Link
// @namespace https://github.com/
// @version 1.1
// @description Add a link that copies the full git clone command
// @match https://github.com/*/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
function addCloneButton() {
if (document.getElementById('gm-clone-command')) return;
const codeButton = document.querySelector('get-repo details summary');
if (!codeButton) return;
const repoPath = location.pathname.split('/').slice(0, 3).join('/');
const cloneUrl = `https://github.com${repoPath}.git`;
const cloneCmd = `git clone ${cloneUrl}`;
const btn = document.createElement('button');
btn.id = 'gm-clone-command';
btn.textContent = 'Copy Full Clone';
btn.style.marginLeft = '8px';
btn.className = 'btn btn-sm';
btn.onclick = () => {
navigator.clipboard.writeText(cloneCmd);
btn.textContent = 'Copied!';
setTimeout(() => btn.textContent = 'Copy Full Clone', 2000);
};
codeButton.parentElement.appendChild(btn);
}
const observer = new MutationObserver(addCloneButton);
observer.observe(document.body, { childList: true, subtree: true });
addCloneButton();
})();
Last active
March 11, 2026 15:03
-
-
Save 0xack13/c9326ac088c5976014c1d96eff0eb011 to your computer and use it in GitHub Desktop.
GM collections
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment