Clone a repository
Situation
You want to clone a repository with an ordinary Git client and work on it locally, and do not know which address and which credentials apply.
Approach
The wiki serves the repositories through a Git endpoint of its own. A Git client talks to it like any HTTP server: clone, fetch, pull and push work unchanged. Authentication is HTTP Basic with a personal access token, not with the wiki password.
The full address is on the repository screen under Dieses Repository beziehen. It is printed there rather than assembled by hand — it depends on this wiki's address and on the namespace the repository is mounted on. A finished address looks like this:
https://www.wvds.it/wiki/lib/plugins/wkdoadogit/git.php/code/dokuwiki-plugins/wkdoadogit
That is the address of this repository on this installation. For any other repository, read it off that repository's screen.
Procedure
- Create an access token if you have none: Access tokens. The full guide is at Create an access token.
- Open Repositories and choose the repository.
- Expand Dieses Repository beziehen and take the address with Kopieren. Without active JavaScript the button does not appear; a click into the address field then selects the address in full.
- Clone with the Git client of your choice. On the command line:
git clone https://www.wvds.it/wiki/lib/plugins/wkdoadogit/git.php/code/dokuwiki-plugins/wkdoadogit
- Git asks for a user name and a password. Enter:
| Field | Value |
|---|---|
| User name | anything — the endpoint does not check it |
| Password | your personal access token |
- So that Git does not ask again on every call, store the token once in the credential store. Git for Windows brings one:
git config --global credential.helper manager
Alternatively the buttons In VS Code öffnen and In JetBrains öffnen hand the same address to an installed development environment. VS Code opens its clone dialog with the address prefilled; with JetBrains the Toolbox takes the call and creates the project in the last used IDE. Where the program is not installed nothing happens — the browser then has nobody to hand the protocol to.
Remarks
The user name really does not matter. The endpoint reads the Basic password and falls back to the user name only as a substitute; the token alone determines identity. Somebody looking for the “right” user name is looking for something that plays no part. The one exception: do not leave the password field empty, or the user name is read as the token and authentication fails.
Four levels, and the level for cloning is not enough for giving back. What the endpoint accepts hangs on the permission on the namespace the repository is mounted on:
| Your level | clone / fetch / pull | push |
|---|---|---|
| view | refused | refused |
| obtain | works | refused |
| propose | works | only under your own branch prefix |
| write | works | unrestricted |
Which level you hold is granted by the repository's mount. The four templates for it grant view, obtain and write; the level propose arises only from a rule written specially and is therefore the rare case. Where the section Dieses Repository beziehen carries the note about read-only access, you hold obtain: a push is refused, and the way onward is Request access.
Only on the level propose does the branch name decide as well. Accepted are then only the branches under your own prefix — refs/heads/users/<your wiki login>/<topic> — and a push to main is refused with push refused: outside_own_prefix before a byte reaches the source system. On the level write that barrier does not apply. Where it does, work on a suitably named branch from the start; for the login mmuster:
git switch -c users/mmuster/table-wrapping git commit -am "Tables wrap on narrow displays" git push -u origin users/mmuster/table-wrapping
Where you have already committed on a differently named branch, name the target explicitly on the push instead of renaming the branch:
git push origin HEAD:refs/heads/users/mmuster/table-wrapping
What happens to the branch afterwards is at Submit a change.
A public repository can be cloned without a token. The endpoint permits an anonymous clone where the mount explicitly allows it. You need a token only once the repository is not public or you want to give something back; anonymously a push is never accepted.
Several addresses with a multilingual mount. Where a repository is mounted in several language namespaces, the section lists one address per namespace. One of them is enough for a clone; they lead to the same repository but are each subject to the rules of their namespace. The two IDE buttons always hand over the first — which language a working copy has is of no consequence for a clone.
When authentication is asked for repeatedly. The endpoint answers 401 as long as no valid token arrives, and Git asks again in response. A withdrawn or badly pasted token looks exactly like none at all. Check the token under Access tokens and, in doubt, create a new one.
Related topics
- Clone a mounted repository — the same task from the plugin's side, with the table of required permission levels