Guides · 9 of 11
Keep your website or app in a git repository
Connect your website or app to a git repository of yours, so each change you make in Spaka becomes a commit and what a developer pushes comes back into Spaka.
Git sync keeps your website or app in step with a git repository, both ways. Each change you make in Spaka becomes a commit there, and what a developer pushes to the repository comes back into Spaka. It works with any host: GitHub, GitLab, Bitbucket, Gitea or a server of your own.
Connect a repository
Section titled “Connect a repository”Create the repository first, on your host, and leave it empty: no README, no license. Spaka writes over nothing.
- Click the settings button beside the name of your website or app, above the conversation (its tooltip says Settings of and the name).
- In the Git sync group, paste the repository’s address,
git@github.com:you/repo.gitorhttps://…. - Click Connect. Spaka checks the repository without changing anything, and ticks what it found: “The repository is empty.” and “Your git (2.47.1) reaches it with your own keys.”
- Check the Branch,
mainunless you change it, and who the commits are by: “Commits are by Spaka, with you as co-author”, with your name and e-mail as your git knows them. - Click Connect and send this website or app.
Your website or app becomes the repository’s first commit, “Start syncing with Spaka”. The group then shows the address, the branch and In step.
Spaka never sends the installed packages, your secrets, what visitors sent through your forms, or the test records.
Without git on your computer
Section titled “Without git on your computer”When your computer has no git, Spaka uses its own, which only reaches https:// addresses. The group asks for more:
- For a repository on github.com, when you publish on GitHub Pages, the button Use my GitHub connection, followed by your account’s name, signs in with that account. Spaka only reaches the repositories you give the Spaka Publish app in its settings on GitHub.
- Anywhere else, or if you’d rather, an Access token that can write to the repository. It’s kept encrypted on your computer.
- Your Name and E-mail, as co-author of the commits.
Follow the sync
Section titled “Follow the sync”Once connected, a button at the left of Publish, in the preview bar, shows the branch and a dot:
- green: In step;
- Syncing… while Spaka sends or checks;
- 2 waiting when the repository is out of reach. The commits wait on your computer and are sent once it answers again;
- orange, after a conflict (see below);
- red, Stopped.
Click it to see the state, when it last synced, the repository’s address and branch, and its last three commits with who made them. Sync checks the repository now, and Settings… opens the Git sync group.
What becomes a commit
Section titled “What becomes a commit”Every version of your website or app, the ones in its history, becomes a commit, sent right away. Spaka is its author and you’re its co-author.
- An agent’s turn: the agent gives the commit a short title in English, such as “Add a pricing page with three plans”, and your message goes underneath.
- Your changes by hand: “Edited by hand in Spaka”.
- Going back to a version: “Restored”, with the version’s name. Spaka never rewrites the repository’s history: going back is one more commit.
- Files changed outside Spaka, in another editor: “Changes made outside Spaka”, the next time Spaka looks.
Files of the repository that Spaka doesn’t send, such as a developer’s .github folder, stay in the repository as they are.
When a developer pushes
Section titled “When a developer pushes”Spaka checks the repository when your website or app opens, every 5 minutes while it’s open, and when you click Sync. What a developer pushed comes into your website or app between two turns of the agent, never during one. It’s a version of its own in the history, “From the repository:” followed by the commit’s title, and the agent is told which files changed before your next message.
When you both changed different lines, Spaka merges the two and sends the result.
A conflict
Section titled “A conflict”When you both changed the same lines, Spaka doesn’t ask you to pick between them line by line. It sends your version to a branch of its own, spaka-sync, and your website or app takes the repository’s version. A notice above the preview says so: “Your website or app and the repository both changed the same lines. Your changes went to the branch spaka-sync, and here is the repository’s version.”
- Get mine back brings your version back and sends it to the repository as a new commit.
- Copy branch name copies
spaka-sync, for the developer who’ll merge it. - Dismiss puts the notice away. Your version stays in the history either way.
If spaka-sync already holds someone else’s work, Spaka uses spaka-sync- followed by the date. A repository that refuses Spaka’s commits, a protected branch for instance, is treated the same way: your changes go to spaka-sync, and the notice gives the repository’s own words.
Switch branch
Section titled “Switch branch”- In the Git sync group, click the branch.
- Choose another of the repository’s branches, or New branch from this version…, then type its name and click Create.
Spaka first sends what’s waiting. Your website or app then shows the branch’s version, and the version you leave stays in the history. A new branch starts from your website or app as it is. You can’t switch while the agent is working.
Open a website or app from its repository
Section titled “Open a website or app from its repository”On another computer, or after a developer set it up, you can open a website or app straight from its repository.
- In the sidebar, click Open from a git repository…, below Open a folder….
- Paste the repository’s address. Without git on your computer, Spaka signs in to github.com with your GitHub connection, or asks for an access token, then your name and e-mail, as above.
- Click Open.
It goes in Documents › Spaka, under its name, and opens with its Git sync already connected. It’s the same website or app as on the first computer: the two keep in step through the repository. Its history starts on this computer; each computer keeps its own.
Spaka refuses a repository that doesn’t hold a Spaka website or app, and a website or app that’s already on this computer: “This website or app is already on this computer, in Documents › Spaka › Bakery.”
Disconnect
Section titled “Disconnect”In the Git sync group, click ···, then Disconnect…, and confirm. The repository and your website or app stay as they are; Spaka forgets the connection on this computer. You can connect to the same repository again later: Spaka finds your website or app in it.
Good to know
Section titled “Good to know”- The repository must be empty, or already hold this same website or app. Spaka refuses one with anything else in it: “This repository isn’t empty.”
- One branch is synced at a time.
- An
ssh://orgit@address needs git on your computer. - On GitHub, a file over 100 MB stops the sync, and the notice names it. Make it smaller or remove it, then click Sync. Other hosts say their own limit when they refuse a file.