This guide will help you use GitHub Codespaces to preview changes to the InnerSource Commons website without needing to set up a local development environment.
GitHub Codespaces is a cloud-based development environment that allows you to work on projects directly from your browser. It's perfect for contributors who don't want to set up a local development environment.
Go to the InnerSource Commons website repository on GitHub.
- Click the green "Code" button near the top right of the repository page
- Select the "Codespaces" tab
- Click "Create codespace on master"
The Codespace will take a minute or two to set up. You'll see a loading screen while it prepares the environment.
Once the Codespace is loaded, you can start the Hugo server using any of these methods:
Option A: Command Line (Recommended and Easiest)
- Open the terminal (Terminal → New Terminal if not already open)
- Run:
hugo server
That's it! In Codespaces, the hugo server command automatically detects the environment and configures everything correctly.
Option B: Using the Run and Debug Panel
- Click the "Run and Debug" icon in the left sidebar (it looks like a play button with a bug)
- At the top of the Run and Debug panel, click on the dropdown and select "Hugo Server"
- Click the green play button to start the Hugo server
Option C: Using npm
- Open the terminal (Terminal → New Terminal)
- Run:
npm start
All methods work correctly in Codespaces and will automatically configure the proper URL so that CSS and assets load correctly.
When the Hugo server starts:
- A notification will appear in the bottom right corner saying "Your application running on port 1313 is available"
- Click "Open in Browser" to view the website in a new tab
- Navigate to the
contentfolder to find the files you want to edit - Make your changes to the files
- Save your changes (Ctrl+S or Cmd+S)
- The website preview will automatically update with your changes
- Click the branch name in the bottom left corner of the Codespace
- Select "Create new branch..." from the dropdown menu
- Enter a name for your branch and press Enter
- Click the "Source Control" icon in the left sidebar (it looks like a branch)
- Review your changes
- Enter a commit message in the text box
- Click the checkmark icon to commit your changes
- After committing your changes, click the "..." menu in the Source Control panel
- Select "Push" to push your changes to GitHub
- When prompted, click "Create Pull Request"
- Fill out the pull request form and click "Create"
If you encounter any issues:
- CSS not loading (assets loading from localhost:1313): This means the Codespace environment wasn't detected properly. Try these steps:
- Stop the Hugo server (Ctrl+C in the terminal or stop debugging)
- Run
.devcontainer/debug-codespaces.shin the terminal to check your environment - Make sure you see the "Running in Codespaces mode" message when starting Hugo
- If the environment variables are not set, try rebuilding the container (see below)
- Hugo server not starting: Try restarting the Codespace by clicking on the menu in the bottom left corner and selecting "Codespaces: Stop Current Codespace" and then restarting it.
- Changes not showing: Make sure you've saved your files and that the Hugo server is running.
- Port not forwarding: Click the "Ports" tab at the bottom of the Codespace and make sure port 1313 is forwarded.
- Container in recovery mode: If you see a message about the container running in recovery mode, click the "Rebuild Container" button in the notification or run the "Codespaces: Rebuild Container" command from the command palette (F1).
If you're stuck, you can:
- Check the Hugo documentation
- Ask for help in the InnerSource Commons community channels
- Create an issue on the GitHub repository
