2022-02-14 13:15:05 -08:00
---
eleventyNavigation:
key: PushingOutput
title: Pushing output from SSGs into Codeberg Pages
parent: CodebergPages
author: Fayçal Alami Hassani - https://codeberg.org/ka2in
date: January 2022
2022-04-16 22:28:59 -07:00
order: 101
2022-02-14 13:15:05 -08:00
---
2025-06-14 02:38:21 -07:00
If you are using a static site generator (SSG) and are satisfied with the result of your project on your local development
environment, you can push the files to your Codeberg Pages repository.
2022-02-14 13:15:05 -08:00
2022-08-04 19:28:17 -07:00
To begin with, we will have two separate repositories, both locally and on Codeberg:
2022-02-14 13:15:05 -08:00
2025-06-14 02:38:21 -07:00
- A main repository for the source files, i.e. where the source files related to your main project will be located.
We will refer to this repository as the `source` repository.
This repository is the one associated with your [mydocs ](/codeberg-pages/examples/docs-as-code/#mydocs ) folder.
2022-02-14 13:15:05 -08:00
2025-06-14 02:38:21 -07:00
- A second repository for Codeberg pages that we will call the `pages` repository.
This repository will only contain the files available in the `html` folder located under docs/build/html.
2022-02-14 13:15:05 -08:00
2024-03-10 09:13:45 -07:00
{% admonition "warning" %}
2025-06-14 02:38:21 -07:00
The `pages` repository **must** be public, as Codeberg Pages will directly fetch the files from the repository,
just like an ordinary user would.
2024-03-10 09:13:45 -07:00
{% endadmonition %}
2023-11-26 21:45:00 -08:00
{% admonition "info" %}
2025-06-14 02:38:21 -07:00
For the purpose of this guide, we have chosen to use two separate folders/repositories.
However, you may want to have a different setup that involves creating a [submodule ](https://git-scm.com/book/en/v2/Git-Tools-Submodules )
instead of having folders and repositories in separate locations. With a submodule, your configuration may look like so:
2023-11-26 21:45:00 -08:00
```
├── sources --> This is a git repo
│ ├── build
│ │ └── html
│ │ └── pages --> This is a separate git repo
│ └── content
```
{% endadmonition %}
2022-02-14 13:15:05 -08:00
2022-04-16 22:28:59 -07:00
To copy the content of the `html` folder to your new `pages` folder, run the command:
2022-02-14 13:15:05 -08:00
```bash
2024-06-11 00:51:22 -07:00
(.venv) $ cp -R docs/build/html/ pages
2022-02-14 13:15:05 -08:00
```
2022-08-04 19:28:17 -07:00
We will now initialize an empty repository inside the pages folder. To do this, type the command:
2022-02-14 13:15:05 -08:00
```bash
$ git init
```
2024-06-11 00:51:22 -07:00
To check the status of your project’ s files, type the command:
2022-02-14 13:15:05 -08:00
```bash
$ git status
```
To add all the files that are available in your directory to Git, run the command:
```bash
$ git add -A
```
2022-08-04 19:28:17 -07:00
Now we will commit:
2022-02-14 13:15:05 -08:00
```bash
2022-08-04 19:28:17 -07:00
$ git commit -m "Example commit message"
2022-02-14 13:15:05 -08:00
```
2022-08-04 19:28:17 -07:00
Repeat these steps in your `source` folder, then push your local commits to the remote repository with the command:
2022-02-14 13:15:05 -08:00
```bash
$ git push origin HEAD:your-remote-branch-name
2024-06-11 00:51:22 -07:00
```
2022-02-14 13:15:05 -08:00
2023-11-26 21:45:00 -08:00
{% admonition "info" "Note" %}
2025-06-14 02:38:21 -07:00
Replace `your-remote-branch-name` with the name of your remote branch. It is recommended to initially push your commits
to a branch other than the default branch. Once you have made sure everything went smoothly, you can then make a pull
request to merge it into the default branch. To learn more about pull requests, read the article [Pull requests and Git flow ](https://docs.codeberg.org/collaborating/pull-requests-and-git-flow/ ).
2023-11-26 21:45:00 -08:00
{% endadmonition %}
2022-02-14 13:15:05 -08:00
2025-06-14 02:38:21 -07:00
You should now be able to access your content by visiting https://{username}.codeberg.page.
You can find more information in the [Codeberg Pages ](/codeberg-pages/ ) section.