76 lines
2.3 KiB
Markdown
76 lines
2.3 KiB
Markdown
# 10 — Working from your computer
|
|||
|
|
|
||
|
|
🌍 **English** · [Türkçe](../../tr/10-clone-and-tokens/readme.md) · [Deutsch](../../de/10-clone-and-tokens/readme.md) · [Français](../../fr/10-clone-and-tokens/readme.md) · [Русский](../../ru/10-clone-and-tokens/readme.md)
|
||
|
|
|
||
|
|
The browser is enough for documents. For real work — many files at once, or running the code — copy the repository to your machine.
|
||
|
|
|
||
|
|
## Getting a copy
|
||
|
|
|
||
|
|
Press the **Clone** button on the repository page and copy the address.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git clone https://forge.kabaforce.com/owner/project.git
|
||
|
|
cd project
|
||
|
|
```
|
||
|
|
|
||
|
|
## The daily loop
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git pull # get what others changed
|
||
|
|
# ... edit files ...
|
||
|
|
git status # what did I change?
|
||
|
|
git add . # stage the changes
|
||
|
|
git commit -m "add setup notes"
|
||
|
|
git push # send them to KabaForge
|
||
|
|
```
|
||
|
|
|
||
|
|
If `git push` is rejected, somebody else pushed first: run `git pull`, resolve anything it reports, then push again.
|
||
|
|
|
||
|
|
## Signing in from the command line
|
||
|
|
|
||
|
|
Your KabaForce ID password does not work over HTTPS. Create a token instead:
|
||
|
|
|
||
|
|
1. **Avatar → Settings → Applications → Generate New Token**.
|
||
|
|
2. Give it a name and only the permissions you need (`repo` is usually enough).
|
||
|
|
3. Copy it once — it is never shown again.
|
||
|
|
4. When git asks for a password, paste the token.
|
||
|
|
|
||
|
|
Store it so you are asked only once:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git config --global credential.helper store
|
||
|
|
```
|
||
|
|
|
||
|
|
## SSH instead of tokens
|
||
|
|
|
||
|
|
1. Create a key if you do not have one: `ssh-keygen -t ed25519`
|
||
|
|
2. Copy `~/.ssh/id_ed25519.pub`.
|
||
|
|
3. **Avatar → Settings → SSH Keys → Add Key**, paste it.
|
||
|
|
4. Clone with the SSH address shown under **Clone**.
|
||
|
|
|
||
|
|
No password prompts after that.
|
||
|
|
|
||
|
|
## Useful extras
|
||
|
|
|
||
|
|
| Need | Command |
|
||
|
|
|------|---------|
|
||
|
|
| See the history | `git log --oneline --graph` |
|
||
|
|
| Discard local changes to a file | `git restore file.md` |
|
||
|
|
| Switch branch | `git switch branch-name` |
|
||
|
|
| Create a branch | `git switch -c new-branch` |
|
||
|
|
|
||
|
|
## Automation
|
||
|
|
|
||
|
|
Repositories can also be read and written through the KabaForge API using the same token:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
curl -H "Authorization: token YOUR_TOKEN" \
|
||
|
|
https://forge.kabaforce.com/api/v1/repos/owner/project/contents
|
||
|
|
```
|
||
|
|
|
||
|
|
Treat tokens like passwords: never put one in a file you commit.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
⬅ [Previous: 09 — Branches and pull requests](../09-branches-and-pull-requests/readme.md) · 📚 [Contents](../README.md)
|