|
| 1 | +# Using GitHub Codespaces for Website Preview |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +## What is GitHub Codespaces? |
| 6 | + |
| 7 | +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. |
| 8 | + |
| 9 | +## Getting Started with Codespaces |
| 10 | + |
| 11 | +### Step 1: Navigate to the Repository |
| 12 | + |
| 13 | +Go to the [InnerSource Commons website repository](https://github.com/InnerSourceCommons/innersourcecommons.org) on GitHub. |
| 14 | + |
| 15 | +### Step 2: Create a New Codespace |
| 16 | + |
| 17 | +1. Click the green "Code" button near the top right of the repository page |
| 18 | +2. Select the "Codespaces" tab |
| 19 | +3. Click "Create codespace on master" |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +### Step 3: Wait for the Codespace to Load |
| 24 | + |
| 25 | +The Codespace will take a minute or two to set up. You'll see a loading screen while it prepares the environment. |
| 26 | + |
| 27 | +### Step 4: Run the Hugo Server |
| 28 | + |
| 29 | +Once the Codespace is loaded: |
| 30 | + |
| 31 | +1. Click the "Run and Debug" icon in the left sidebar (it looks like a play button with a bug) |
| 32 | +2. At the top of the Run and Debug panel, click on the dropdown and select "Hugo Server" |
| 33 | +3. Click the green play button to start the Hugo server |
| 34 | + |
| 35 | +### Step 5: View the Website Preview |
| 36 | + |
| 37 | +When the Hugo server starts: |
| 38 | + |
| 39 | +1. A notification will appear in the bottom right corner saying "Your application running on port 1313 is available" |
| 40 | +2. Click "Open in Browser" to view the website in a new tab |
| 41 | + |
| 42 | +### Step 6: Make and Preview Changes |
| 43 | + |
| 44 | +1. Navigate to the `content` folder to find the files you want to edit |
| 45 | +2. Make your changes to the files |
| 46 | +3. Save your changes (Ctrl+S or Cmd+S) |
| 47 | +4. The website preview will automatically update with your changes |
| 48 | + |
| 49 | +## Working with Branches and Pull Requests |
| 50 | + |
| 51 | +### Creating a New Branch |
| 52 | + |
| 53 | +1. Click the branch name in the bottom left corner of the Codespace |
| 54 | +2. Select "Create new branch..." from the dropdown menu |
| 55 | +3. Enter a name for your branch and press Enter |
| 56 | + |
| 57 | +### Committing Your Changes |
| 58 | + |
| 59 | +1. Click the "Source Control" icon in the left sidebar (it looks like a branch) |
| 60 | +2. Review your changes |
| 61 | +3. Enter a commit message in the text box |
| 62 | +4. Click the checkmark icon to commit your changes |
| 63 | + |
| 64 | +### Creating a Pull Request |
| 65 | + |
| 66 | +1. After committing your changes, click the "..." menu in the Source Control panel |
| 67 | +2. Select "Push" to push your changes to GitHub |
| 68 | +3. When prompted, click "Create Pull Request" |
| 69 | +4. Fill out the pull request form and click "Create" |
| 70 | + |
| 71 | +## Troubleshooting |
| 72 | + |
| 73 | +If you encounter any issues: |
| 74 | + |
| 75 | +- **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. |
| 76 | +- **Changes not showing**: Make sure you've saved your files and that the Hugo server is running. |
| 77 | +- **Port not forwarding**: Click the "Ports" tab at the bottom of the Codespace and make sure port 1313 is forwarded. |
| 78 | + |
| 79 | +## Getting Help |
| 80 | + |
| 81 | +If you're stuck, you can: |
| 82 | + |
| 83 | +1. Check the [Hugo documentation](https://gohugo.io/documentation/) |
| 84 | +2. Ask for help in the InnerSource Commons community channels |
| 85 | +3. Create an issue on the GitHub repository |
0 commit comments