Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Mar 31, 2024
1 parent b70de65 commit 408d866
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,25 @@ Additional guides:
- Create a GitHub Personal Access Token. [[Link]](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)
- Add authentication token to Travis CI. [[Link]](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-settings)

## Important Notice: Force Push Behavior

The `hexo-deployer-git` plugin employs a force push (`git push --force`) strategy when deploying updates to your site. This approach ensures that the remote repository aligns exactly with your local deployment, providing a clean, consistent state for each update. However, it comes with an important consideration regarding custom modifications.

### Impact of Force Push

Using force push means that any changes made directly in the remote repository (e.g., via GitHub's web interface or through a separate git workflow) will be **overwritten** when the next deployment occurs. This is because force push does not merge changes; it replaces the remote content with the local version entirely.

### How to Safely Manage Your Site

To prevent unintended loss of work, we strongly advise adhering to the following best practices:

1. **Centralize Changes in Your Hexo Source:** Make all content and configuration changes within your local Hexo root directory. This ensures all modifications are included in the deployment process and preserved in your source control.

2. **Avoid Direct Remote Modifications:** Refrain from directly editing files in the GitHub repository through the web interface or other git methods. Doing so could lead to these changes being lost on the next deployment.

## Custom Domain Issue with CNAME File

If you are using a custom domain with GitHub Pages, you might have encountered an issue where your custom domain configuration gets lost after deploying updates to your site. This problem occurs due to the deletion of the `CNAME` file in the root of the deployed directory during the git commit and push process performed by the `hexo-deployer-git` plugin.
If you are using a custom domain with GitHub Pages, you might have encountered an issue where your custom domain configuration gets lost after deploying updates to your site. This problem occurs due to the overwritten / deletion of the `CNAME` file in the root of the deployed directory during the git commit and push process performed by the `hexo-deployer-git` plugin.

GitHub requires the `CNAME` file to be present in your repository to associate your custom domain with your GitHub Pages site. When this file is missing, GitHub resets the custom domain setting, leading to the site being accessible only through the default `github.io` domain.

Expand Down

0 comments on commit 408d866

Please sign in to comment.