# example-pages ## Introduction This is simple example to serve plain static files using gitlab pages. Further information for generate pages can be found here: [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/) The access controll via OAuth is not configured yet. However the gitlab page of private repositories looks like * Public: [https://mmoessler.aidaho-pages.uni-hohenheim.de/example-pages/](https://mmoessler.aidaho-pages.uni-hohenheim.de/example-pages/) * Private: [https://example-private-pages-c883cb.aidaho-pages.uni-hohenheim.de/](https://example-private-pages-c883cb.aidaho-pages.uni-hohenheim.de/) --- ## Step 1: Set Up a GitLab Project 1. **Log in to GitLab**: Go to your GitLab account. 2. **Create a New Project**: - Click the **New Project** button. - Choose between creating a blank project, importing an existing one, or using a template. - Give the project a name, e.g., `my-pages-site`. - Ensure the project is **Public** if you want the GitLab Pages site to be accessible to everyone. --- ## Step 2: Add a Configuration File 1. **Clone the Repository**: - Use the GitLab web interface to copy the repository URL. - Clone it to your local machine: ```bash git clone ``` 2. **Add a GitLab Pages Configuration**: - Add a `.gitlab-ci.yml` file to the root of your repository with the following content: ```yaml pages: stage: deploy script: - mkdir .public - cp -r * .public - mv .public public artifacts: paths: - public only: - main ``` - This script assumes your site's static files are in the root directory. Adjust as needed for your project. --- ## Step 3: Push Your Code 1. **Add Your Static Files**: - Place your website's HTML, CSS, and JavaScript files in the project directory. 2. **Commit and Push**: - Commit your changes: ```bash git add . git commit -m "Initial commit for GitLab Pages" git push origin main ``` --- ## Step 4: Configure GitLab Pages 1. **Enable Pages in Your Project Settings**: - Go to your project in GitLab. - Navigate to **Settings > Pages**. - Verify that your Pages are enabled and note the URL provided by GitLab for your site (e.g., `[https://.gitlab.io/](https://mmoessler.aidaho-pages.uni-hohenheim.de/example-pages/)`). --- ## Step 5: Test Your Site 1. **Access Your Site**: - Open your browser and visit `https://aidaho-pages.uni-hohenheim.de`. - Ensure everything loads correctly. --- You now have a GitLab Pages site hosted at your custom domain! If you encounter any issues during the setup, revisit the steps or seek assistance.