-
Fix
In the empty repo "Get Started" component:
- Fetch the current logged-in user via useCurrentUser() hook
- Construct the clone URL as: http://:@localhost/git/.git
- Since PAT is not stored client-side, show a placeholder for the token
- Add a note: "Generate a PAT from User > Tokens"
- Remove the separate Username/Password prompt lines
Estimated Fix Time
1 hour
Files Changed
- Find the empty repo "Get Started with Git" component in frontend/src
-
Fix:
diff --git a/frontend/src/components/project/ProjectCreatedModal.tsx b/frontend/src/components/project/ProjectCreatedModal.tsx index f46eb24..90d8b8d 100644 --- a/frontend/src/components/project/ProjectCreatedModal.tsx +++ b/frontend/src/components/project/ProjectCreatedModal.tsx @@ -21,9 +21,9 @@ export function ProjectCreatedModal({ }: ProjectCreatedModalProps) { const [copied, setCopied] = useState(false); const [revealed, setRevealed] = useState(false); - + const [copiedConfig, setCopiedConfig] = useState(false); // move here + const [copiedCloneUrl, setCopiedCloneUrl] = useState(false); const maskedToken = token.substring(0, 11) + '•'.repeat(token.length - 11); - const copyToken = async () => { try { // Try modern clipboard API first @@ -128,13 +128,32 @@ export function ProjectCreatedModal({ </p> <div className="bg-gray-900 rounded border border-gray-700 p-3 mb-4"> - <pre className="text-sm text-gray-200 font-mono"> - <code>{`$ git clone ${gitUrl} -Username: ${username} -Password: `}<span className="text-yellow-400">[paste your token]</span> - </code> - </pre> - + <div className="flex items-center justify-between gap-2"> + <pre className="text-sm text-gray-200 font-mono overflow-hidden"> + <code>{`$ git clone ${gitUrl.replace('://', `://${username}:${token.substring(0, 10)}…@`)}`}</code> + </pre> + <button + onClick={async () => { + const fullUrl = `git clone ${gitUrl.replace('://', `://${username}:${token}@`)}`; + if (navigator.clipboard && navigator.clipboard.writeText) { + await navigator.clipboard.writeText(fullUrl); + } else { + const el = document.createElement('textarea'); + el.value = fullUrl; + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + } + setCopiedCloneUrl(true); + setTimeout(() => setCopiedCloneUrl(false), 2000); + }} + className="shrink-0 text-gray-400 hover:text-white transition" + title="Copy clone URL" + > + {copiedCloneUrl ? <Check size={16} className="text-green-400" /> : <Clipboard size={16} />} + </button> + </div> <div className="text-xs text-gray-500 mt-2"> Need a Personal Access Token? Generate one anytime from{" "} <Link to="/account/tokens" className="underline font-medium"> @@ -147,9 +166,32 @@ Password: `}<span className="text-yellow-400">[paste your token]</span> </p> <div className="bg-gray-900 rounded border border-gray-700 p-3"> - <pre className="text-sm text-gray-200 font-mono"> - <code>$ git config --global credential.helper store</code> - </pre> + <div className="flex items-center justify-between gap-2"> + <pre className="text-sm text-gray-200 font-mono"> + <code>$ git config --global credential.helper store</code> + </pre> + <button + onClick={async () => { + const cmd = 'git config --global credential.helper store'; + if (navigator.clipboard && navigator.clipboard.writeText) { + await navigator.clipboard.writeText(cmd); + } else { + const el = document.createElement('textarea'); + el.value = cmd; + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + } + setCopiedConfig(true); + setTimeout(() => setCopiedConfig(false), 2000); + }} + className="shrink-0 text-gray-400 hover:text-white transition" + title="Copy command" + > + {copiedConfig ? <Check size={16} className="text-green-400" /> : <Clipboard size={16} />} + </button> + </div> </div> </div> -
rksuma@Ramakrishnans-MacBook-Pro sztab % git checkout release/1.10.0 git merge bugfix/SZ-131-Incorrect-git-clone-display-on-ui git push git branch -d bugfix/SZ-131-Incorrect-git-clone-display-on-ui git push origin --delete bugfix/SZ-131-Incorrect-git-clone-display-on-ui Switched to branch 'release/1.10.0' Your branch is up to date with 'origin/release/1.10.0'. Updating 9edecce..2bfcb5f Fast-forward frontend/src/components/project/ProjectCreatedModal.tsx | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 12 deletions(-) Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0) remote: remote: Create a pull request for 'release/1.10.0' by visiting: remote: https://tigase.dev/sztab/~pulls/new?target=1325:wolnosc&source=1325:release/1.10.0 remote: To https://tigase.dev/sztab.git 9edecce..2bfcb5f release/1.10.0 -> release/1.10.0 Deleted branch bugfix/SZ-131-Incorrect-git-clone-display-on-ui (was 2bfcb5f). remote: remote: Create a pull request for 'bugfix/SZ-131-Incorrect-git-clone-display-on-ui' by visiting: remote: https://tigase.dev/sztab/~pulls/new?target=1325:wolnosc&source=1325:bugfix/SZ-131-Incorrect-git-clone-display-on-ui remote: To https://tigase.dev/sztab.git - [deleted] bugfix/SZ-131-Incorrect-git-clone-display-on-ui rksuma@Ramakrishnans-MacBook-Pro sztab %
| Type |
Bug
|
| Priority |
Normal
|
| Assignee | |
| Version |
none
|
| Sprints |
n/a
|
| Customer |
n/a
|
Issue Votes (0)
Summary
The "Get Started with Git" panel shown on an empty repository displays incorrect clone instructions. The username is hardcoded as the project owner rather than the logged-in user, and the format shows username and password as separate interactive prompts instead of the correct PAT-embedded URL format.
Steps to Reproduce
Expected Behavior
Clone URL should embed credentials directly:
Where logged-in-username is the currently authenticated user and PAT is their personal access token.
Actual Behavior
Instructions show:
Two problems: