### Clone Example Repository Source: https://docs.codeberg.org/collaborating/resolve-conflicts Clone the example repository to follow along with the conflict resolution steps. ```bash git clone git@codeberg.org:knut/examples.git cd examples ``` -------------------------------- ### Numbered List Example Source: https://docs.codeberg.org/markdown/using-lists Create a numbered list by starting each item with a number followed by a period. ```markdown 1. This 2. is 3. a 4. numbered 5. list ``` -------------------------------- ### Personal Site Subdomain ALIAS/TXT Example Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain Example DNS configuration for a personal site subdomain using ALIAS and TXT records. Assumes domain 'example.com', username 'frida', and site 'myself.example.com'. ```dns name `myself.example.com`, type `ALIAS`, data `codeberg.page` name `myself.example.com`, type `TXT`, data `frida.codeberg.page` ``` -------------------------------- ### Personal Site Subdomain A/AAAA/TXT Example Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain Example DNS configuration for a personal site subdomain using A, AAAA, and TXT records. Assumes domain 'example.com', username 'frida', and site 'myself.example.com'. ```dns name `myself.example.com`, type `A`, data `217.197.84.141` name `myself.example.com`, type `AAAA`, data `2a0a:4580:103f:c0de::2` name `myself.example.com`, type `TXT`, data `frida.codeberg.page` ``` -------------------------------- ### Install Git LFS Source: https://docs.codeberg.org/git/using-lfs Installs Git LFS for the current user. This command only needs to be run once per user. ```bash git lfs install ``` -------------------------------- ### Switching to Main Branch Source: https://docs.codeberg.org/collaborating/resolve-conflicts Ensure you are on the `main` branch before starting the conflict resolution examples. ```git git switch main ``` -------------------------------- ### View Branches Source: https://docs.codeberg.org/collaborating/resolve-conflicts Check the current branch and list all branches to confirm the setup before merging. ```bash git switch main git branch add-link-to-readme * main update-last-sentence-in-readme ``` -------------------------------- ### Navigate to Repository Directory Source: https://docs.codeberg.org/git/clone-commit-via-cli Change your current directory to the cloned repository's root folder to start making changes. ```bash ~$ cd examples ~/examples$ ``` -------------------------------- ### Example Workflow for Multi-Platform Testing Source: https://docs.codeberg.org/ci/agents This workflow demonstrates how to configure matrix builds to test across different operating systems and architectures. It specifies Go platform strings for matrix expansion. ```yaml matrix: DATABASE: - postgres - mariadb platform: - darwin/arm64 - linux/amd64 - linux/arm64 - linux/riscv64 labels: platform: ${platform} steps: # run tests on all platforms - name: test image: rust commands: - cargo test # check benchmarks on amd64 - name: test-benchmarks-amd64 image: rust commands: - cargo bench when: platform: */amd64 # check benchmarks on arm64 - name: test-benchmarks-arm64 image: rust commands: - cargo bench when: platform: */arm64 # check benchmarks on riscv64 - name: test-benchmarks-riscv64 image: rust commands: - cargo bench when: platform: */riscv64 ``` -------------------------------- ### Personal Site Subdomain CNAME Example Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain Example DNS configuration for a personal site subdomain using a CNAME record. Assumes domain 'example.com', username 'frida', and site 'myself.example.com'. ```dns name `myself.example.com`, type `CNAME`, data `frida.codeberg.page` ``` -------------------------------- ### Unordered List Example Source: https://docs.codeberg.org/markdown/using-lists Create bullet points using dashes or asterisks at the beginning of each list item. ```markdown - This - is - a - simple - bullet - point - list ``` -------------------------------- ### Simple Redirect Example Source: https://docs.codeberg.org/codeberg-pages/advanced-usage This example shows how to redirect specific paths to external URLs or other paths within your site using a 301 status code. ```plaintext /example https://example.com/ 301 /path /other-path 301 ``` -------------------------------- ### Article Front Matter Example Source: https://docs.codeberg.org/improving-documentation/create-article This is an example of the front matter required for a new article. It includes navigation keys, titles, parent section, and order. ```markdown --- eleventyNavigation: key: WhatIsCodeberg title: What is Codeberg? parent: GettingStarted order: 10 --- ## Foo Hello foo! ## Bar Hello bar! ``` -------------------------------- ### Run Keycloak Development Instance Source: https://docs.codeberg.org/integrations/keycloak Starts a Keycloak development instance with administrative credentials and sets a custom hostname URL for local testing. This configuration is not persistent. ```docker docker run -p 8080:8080 \ -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin \ quay.io/keycloak/keycloak:22.0.0 start-dev \ --hostname-url=http://127.0.0.1:8080 ``` -------------------------------- ### Install Git on macOS using Homebrew Source: https://docs.codeberg.org/getting-started/install-git Use this command to install Git on macOS if you have Homebrew installed. Ensure you are on macOS High Sierra (10.13) or higher. ```bash % brew install git ``` -------------------------------- ### Basic Sidebar Example Source: https://docs.codeberg.org/getting-started/wiki Example of a basic sidebar file for a Codeberg wiki. This Markdown file, named `_Sidebar.md`, allows for navigation links and custom content. ```markdown - [[Home]] ### Content - [Page 1](Page-1) > knuts wiki ``` -------------------------------- ### Append Text to README.md Source: https://docs.codeberg.org/getting-started/first-repository Appends the string 'Hello World!' to the README.md file. This is an example of modifying an existing file before committing. ```bash knut@iceberg:~/repositories/foobar$ echo "Hello World!" >> README.md ``` -------------------------------- ### DNS Configuration for Project Subdomain with CNAME Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain This DNS setup is for a project subdomain when it's not the apex of the zone and has no other services like email. A CNAME record is recommended. ```dns name "colormix-app.example.com", type "CNAME", data "colormix.frida.codeberg.page" ``` -------------------------------- ### Resolved Conflict Example Source: https://docs.codeberg.org/collaborating/resolve-conflicts After manually editing the file, this is how the content should look with the conflict resolved and the desired version in place. ```text An example repository to use with the [Codeberg Documentation](https://docs.codeberg.org). ``` -------------------------------- ### DNS Configuration for Project Subdomain with ALIAS Records Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain This DNS setup is for a project subdomain when ALIAS records are supported. It requires ALIAS and TXT records. ```dns name "colormix-app.example.com", type "ALIAS", data "codeberg.page" name "colormix-app.example.com", type "TXT", data "colormix.frida.codeberg.page" ``` -------------------------------- ### Copy Public Key to Clipboard (Linux/Wayland) Source: https://docs.codeberg.org/security/ssh-key Copies the SSH public key to the clipboard using wl-copy. Ensure wl-clipboard is installed. ```bash wl-copy -t text/plain < ~/.ssh/id_ed25519.pub ``` -------------------------------- ### Install Woodpecker Agent using Helm Chart Source: https://docs.codeberg.org/ci/agents Deploy the Woodpecker agent on Kubernetes using the official Helm chart. Replace with the desired chart version. ```bash helm install woodpecker/agent oci://ghcr.io/woodpecker-ci/helm/woodpecker --version ``` -------------------------------- ### Copy Public Key to Clipboard (Linux/X11) Source: https://docs.codeberg.org/security/ssh-key Copies the SSH public key to the clipboard using xclip. Ensure xclip is installed. ```bash xclip -selection clipboard < ~/.ssh/id_ed25519.pub ``` -------------------------------- ### DNS Configuration for Project Apex Domain with ALIAS Records Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain This DNS setup is for a project site's apex domain when ALIAS records are supported. It requires ALIAS for the apex, TXT for verification, and CNAME for the www subdomain. ```dns name "example.com", type "ALIAS", data "codeberg.page" name "example.com", type "TXT", data "colormix.frida.codeberg.page" name "www.example.com", type "CNAME", data "colormix.frida.codeberg.page" ``` -------------------------------- ### Example of Bilingual Translation Format (gettext) Source: https://docs.codeberg.org/codeberg-translate/manual-component-configuration Illustrates how source text is embedded within the code for bilingual translation formats like gettext. ```c printf(_("This is some text")) ``` -------------------------------- ### DNS Configuration for Project Subdomain with A/AAAA Records Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain This DNS setup is for a project subdomain when ALIAS records are not supported. It uses A/AAAA records along with a TXT record for verification. ```dns name "colormix-app.example.com", type "A", data "217.197.84.141" name "colormix-app.example.com", type "AAAA", data "2a0a:4580:103f:c0de::2" name "colormix-app.example.com", type "TXT", data "colormix.frida.codeberg.page" ``` -------------------------------- ### DNS Configuration for Project Apex Domain with A/AAAA Records Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain This DNS setup is for a project site's apex domain when ALIAS records are not supported. It uses A/AAAA records for the apex, a CNAME for the www subdomain, and a TXT record for verification. ```dns name "example.com", type "A", data "217.197.84.141" name "example.com", type "AAAA", data "2a0a:4580:103f:c0de::2" name "example.com", type "TXT", data "colormix.frida.codeberg.page" name "www.example.com", type "CNAME", data "colormix.frida.codeberg.page" ``` -------------------------------- ### DNS Configuration for Apex Domain with ALIAS Records Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain This DNS setup is for an apex domain when ALIAS records are supported. It requires three records: ALIAS for the apex, TXT for verification, and CNAME for the www subdomain. ```dns name "example.com", type "ALIAS", data "codeberg.page" name "example.com", type "TXT", data "frida.codeberg.page" name "www.example.com", type "CNAME", data "frida.codeberg.page" ``` -------------------------------- ### DNS Configuration for Apex Domain with A/AAAA Records Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain This DNS setup is for an apex domain when ALIAS records are not supported. It uses A/AAAA records for the apex and a CNAME for the www subdomain, along with a TXT record for verification. ```dns name "example.com", type "A", data "217.197.84.141" name "example.com", type "AAAA", data "2a0a:4580:103f:c0de::2" name "example.com", type "TXT", data "frida.codeberg.page" name "www.example.com", type "CNAME", data "frida.codeberg.page" ``` -------------------------------- ### Create and Navigate Local Workspace Source: https://docs.codeberg.org/getting-started/first-repository Optional step to organize your projects in a dedicated directory before cloning a repository. ```bash knut@iceberg:~$ mkdir repositories knut@iceberg:~$ cd repositories knut@iceberg:~/repositories$ ``` -------------------------------- ### Navigate and List Cloned Repository Contents Source: https://docs.codeberg.org/getting-started/first-repository Navigates into the newly cloned repository directory and lists its initial contents. ```bash knut@iceberg:~/repositories$ cd foobar knut@iceberg:~/repositories/foobar$ ls LICENSE README.md ``` -------------------------------- ### Initializing Git Repository Source: https://docs.codeberg.org/codeberg-pages/pushing-output Initializes an empty Git repository within the 'pages' folder. This prepares the directory for version control. ```bash git init ``` -------------------------------- ### Splats Redirect Example Source: https://docs.codeberg.org/codeberg-pages/advanced-usage Use splats (`*`) to redirect paths under a specific directory to a new location, preserving the matched path segments. This example uses a 302 temporary redirect. ```plaintext /articles/* /posts/:splat 302 ``` -------------------------------- ### Configure Subdomain for Project Site Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain Use this configuration for your project site when you want it available at a subdomain (e.g., colormix-app.example.com). ```text colormix-app.example.com ``` -------------------------------- ### Initialize a New Git Repository Source: https://docs.codeberg.org/getting-started/first-repository Initializes a new Git repository in an existing local source tree if one is not already present. ```bash knut@iceberg:~/my-project$ git init Initialized empty Git repository in /home/knut/my-project/.git/ ``` -------------------------------- ### Basic Forgejo Actions Deployment Source: https://docs.codeberg.org/codeberg-pages/forgejo-actions Add this step to your workflow to automatically deploy your website. Ensure the 'site' parameter correctly points to your repository's deployment URL. ```yaml - uses: https://codeberg.org/git-pages/action@v2 with: site: 'https://${{ forge.repository_owner }}.codeberg.page/repository-name/' token: ${{ forge.token }} source: _site/ ``` -------------------------------- ### Create Branch and Add Link to README Source: https://docs.codeberg.org/collaborating/resolve-conflicts Create a new branch and modify the README.md file by adding a link. This is the first change that will be merged. ```bash git switch -c add-link-to-readme In the `README.md` file, we change the line ``` An example repository for Codeberg Docs. ``` to ``` An example repository for [Codeberg Docs](https://docs.codeberg.org). ``` Now, we'll add the change to our branch: git add README.md git commit -m "Added link to Codeberg docs in README" ``` -------------------------------- ### Markdown Badge Example Source: https://docs.codeberg.org/getting-started/first-repository Use this markdown to embed a Codeberg badge on your website. Ensure 'your-badge.png' and the repository URL are updated. ```markdown [![Get it on Codeberg](your-badge.png)](https://codeberg.org/your-username/your-repo) ``` -------------------------------- ### ATX-Style Topic (Level 1) Source: https://docs.codeberg.org/markdown/topics Demonstrates a top-level topic using one hash character. ```markdown # 1st Topic ``` -------------------------------- ### Migrate Repository to Use LFS (Info) Source: https://docs.codeberg.org/git/using-lfs Shows information about which files consume the most space in the repository, helping to identify candidates for LFS migration. Use --everything to see all file sizes. ```bash git lfs migrate info ``` -------------------------------- ### Out-of-Order Numbered List Example Source: https://docs.codeberg.org/markdown/using-lists Markdown renders lists with sequential numbers even if the source uses the same number for all items. ```markdown 1. This 1. is 1. also 1. a 1. numbered 1. list ``` -------------------------------- ### ATX-Style Topic (Level 2) Source: https://docs.codeberg.org/markdown/topics Demonstrates a second-level topic using two hash characters. ```markdown ## 2nd Topic ``` -------------------------------- ### List Global Git Configuration Source: https://docs.codeberg.org/git/configuring-git Verify your globally configured Git settings, including user name and email. ```bash git config --global --list ``` -------------------------------- ### Specific Shields.io LiberaPay 'Receives' Badge Markdown Source: https://docs.codeberg.org/integrations/liberapay An example of a shields.io widget for the 'receives' badge, specifically formatted for the username 'codeberg'. ```markdown [![LiberaPay](https://img.shields.io/liberapay/receives/codeberg.svg?logo=liberapay")](https://liberapay.com/codeberg/donate) ``` -------------------------------- ### Set Global Git User Name and Email Source: https://docs.codeberg.org/git/configuring-git Configure your Git username and email address globally. This is typically done once after installing Git. ```bash git config --global user.name 'knut' git config --global user.email 'knut@example.com' ``` -------------------------------- ### HTML Badge Example Source: https://docs.codeberg.org/getting-started/first-repository Use this HTML snippet to embed a Codeberg badge on your website. Replace 'your-badge.png' and the repository URL with your specific details. ```html Get It On Codeberg ``` -------------------------------- ### Create a Mirror Clone of a Repository Source: https://docs.codeberg.org/git/reduce-size Use `git clone --mirror` to create a full copy of your repository, including all references, which is necessary for rewriting history. ```bash git clone --mirror git@codeberg.org:your_user_name/your_repo.git ``` -------------------------------- ### Create a New Branch Source: https://docs.codeberg.org/getting-started/first-repository Creates a new branch named 'main' and switches to it. This is often the first step after initializing a repository. ```bash git checkout -b main ``` -------------------------------- ### ATX-Style Topic (Level 3) Source: https://docs.codeberg.org/markdown/topics Demonstrates a third-level topic using three hash characters. ```markdown ### 3rd Topic ``` -------------------------------- ### SPA Rewrite Example Source: https://docs.codeberg.org/codeberg-pages/advanced-usage Configure a rewrite rule for single-page applications (SPAs) to direct all incoming paths to `/index.html` with a 200 status code. ```plaintext /* /index.html 200 ``` -------------------------------- ### Create Initial Local Commit Source: https://docs.codeberg.org/getting-started/first-repository Creates the first commit locally. This is crucial for Option B to avoid initial conflicts with Codeberg. ```bash git commit -m "first commit" ``` -------------------------------- ### Add Image using Local Git Client Source: https://docs.codeberg.org/getting-started/wiki Workflow for adding images to your wiki using a local Git client. This involves creating a directory for images, copying the image file, and committing the changes. ```bash # create a subfolder for images mkdir images cd images # copy the image into this folder git add images/image.png git commit -m "add image" git push ``` -------------------------------- ### Creating a Branch to Adapt a File Source: https://docs.codeberg.org/collaborating/resolve-conflicts Create a new branch to make changes to a file, which will be used later to demonstrate merging. ```git git switch -c adapt-README-file ``` -------------------------------- ### Edit a File Source: https://docs.codeberg.org/git/clone-commit-via-cli Use a text editor like nano to modify files within your local repository. ```bash ~/examples$ nano README.md ``` -------------------------------- ### ALIAS Record Configuration Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain Use ALIAS and TXT records when CNAME is not suitable, for example, if you need to use the apex domain or have other services like email. The ALIAS record points to 'codeberg.page', and the TXT record specifies your repository location. ```dns Domain | Type | Data ---|---|--- yourdomain.com| ALIAS| codeberg.page yourdomain.com| TXT| reponame.username.codeberg.page www.yourdomain.com| CNAME| reponame.username.codeberg.page ``` -------------------------------- ### Clone Wiki Repository Source: https://docs.codeberg.org/getting-started/wiki Clone the wiki repository for your project using Git. This command fetches the wiki's Git repository, allowing you to manage its content locally. ```bash git clone git@codeberg.org:knut/foobar.wiki.git cd foobar.wiki nano Home.md # or your editor of choice git commit -am "create Home page" ``` -------------------------------- ### Copying Build Artifacts Source: https://docs.codeberg.org/codeberg-pages/pushing-output Copies the contents of the 'html' folder from the build directory to the 'pages' directory. Ensure you are in the correct project directory before running. ```bash (.venv) $ cp -R docs/build/html/ pages ``` -------------------------------- ### Create Another Branch and Update README Source: https://docs.codeberg.org/collaborating/resolve-conflicts Create a second branch from main and modify the README.md file differently. This will create a conflict when merged. ```bash git switch main git switch -c update-last-sentence-in-readme Again, we'll change the last line, but this time, we'll adjust the text differently, from ``` An example repository for Codeberg Docs. ``` to ``` An example repository to use with the Codeberg Documentation. ``` git add README.md git commit -m "Adjusted last sentence in README" ``` -------------------------------- ### Conflict Markers in a File Source: https://docs.codeberg.org/collaborating/resolve-conflicts When a merge conflict occurs, Git inserts markers into the conflicting file to show both versions of the code. The `<<<<<<< HEAD` marker indicates the start of the current branch's version, `=======` separates the two versions, and `>>>>>>> [branch-name]` marks the end of the incoming branch's version. ```text <<<<<<< HEAD An example repository for [Codeberg Docs](https://docs.codeberg.org). ======= An example repository to use with the Codeberg Documentation. >>>>>>> update-last-sentence-in-readme ``` -------------------------------- ### Setext-Style Topic (Level 2) Source: https://docs.codeberg.org/markdown/topics Demonstrates a second-level topic using an underline of dashes. ```markdown This is another topic --------------------- ``` -------------------------------- ### Setext-Style Topic (Level 1) Source: https://docs.codeberg.org/markdown/topics Demonstrates a top-level topic using an underline of equal signs. ```markdown This is a topic =============== ``` -------------------------------- ### Staging All Files for Commit Source: https://docs.codeberg.org/codeberg-pages/pushing-output Adds all files and changes in the current directory to the Git staging area, preparing them for the next commit. ```bash git add -A ``` -------------------------------- ### Clone Repository via HTTP Source: https://docs.codeberg.org/git/clone-commit-via-cli Use this command to create a local copy of a remote repository using its HTTP URL. ```bash ~$ git clone https://codeberg.org/knut/examples.git Cloning into 'examples'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), 214 bytes | 1024 bytes/s, done. ``` -------------------------------- ### Cloning a Repository with Git CLI and 2FA (HTTPS) Source: https://docs.codeberg.org/security/2fa When cloning a repository using HTTPS with 2FA enabled, use your username and the generated access token as the password. The token will be saved for the repository after the first use. ```bash $ git clone https://codeberg.org/username/repo.git Username for 'https://codeberg.org': username Password for 'https://username@codeberg.org': access-token ``` -------------------------------- ### Display README.md Content Source: https://docs.codeberg.org/getting-started/first-repository Displays the current content of the README.md file to the console. ```bash knut@iceberg:~/repositories/foobar$ cat README.md ``` -------------------------------- ### Create a Git Tag Source: https://docs.codeberg.org/git/using-tags Use this command to create an annotated tag in your local Git repository. You can optionally provide a message. ```git git tag -a -m "" ``` -------------------------------- ### Configure Apex Domain for Personal/Organization Site Source: https://docs.codeberg.org/codeberg-pages/using-custom-domain Use this configuration for your personal or organization site when you want it available at the apex domain (e.g., example.com) and redirect www to it. ```text example.com www.example.com ``` -------------------------------- ### Create a Manual Git Mirror Source: https://docs.codeberg.org/getting-started/faq Use this command to create a manual mirror of a repository by adding multiple remotes and pushing with the mirror option. This is an alternative to Codeberg's disabled automatic mirroring. ```git git push --mirror ``` -------------------------------- ### Adding Content to a File and Committing Source: https://docs.codeberg.org/collaborating/resolve-conflicts This command appends a line of text to the specified file and then stages and commits this change. ```git echo "You can find this repository in the Forgejo Web GUI at https://codeberg.org/knut/examples" >> README.md git add README.md git commit -m "added repository url to README.md" ``` -------------------------------- ### View Configured LFS Tracked Patterns Source: https://docs.codeberg.org/git/using-lfs Displays the file patterns that are currently configured to be managed by Git LFS. ```bash git lfs track ``` -------------------------------- ### Configure Git to Sign Commits Source: https://docs.codeberg.org/security/gpg-key Sets your global Git configuration to use a specific GPG key for signing commits and enables automatic commit signing. ```bash git config --global user.signingkey ``` ```bash git config --global commit.gpgsign true ``` -------------------------------- ### Generate a New GPG Key Source: https://docs.codeberg.org/security/gpg-key Initiates the process to generate a new GPG keypair. Follow the prompts to select key type, size, validity period, and enter your personal information and passphrase. ```bash gpg --full-generate-key ``` -------------------------------- ### 2FA Token Time Frames Source: https://docs.codeberg.org/security/2fa Illustrates the 30-second time frames for 2FA token generation and acceptance, showing the 'Previous', 'Current', and 'Next' periods. ```text 00:00 00:30 01:00 v v v | <-----> | <-----> | <-----> ^ ^ ^ Previous Current Next ```