Как обновить gh pages

от admin

Как мне обновить ветку gh-pages?

Ранее я работал над своим новым сайтом GitHub Pages. Мой сайт — это приложение React. Я, наконец, получил сайт, чтобы работать около месяца назад, но я застрял в этом выпуске моего сайта, не автоматически перерисовывая, когда я ввожу изменения в GitHub. Единственный способ, которым я могу вернуть свой веб-сайт, — это опубликовать его, но я почти уверен, что я не должен публиковать его часто.

Я думаю, проблема в том, что я фактически не обновляю ветвь gh-pages моего репозитория, и я не уверен, должен ли я быть. Должна ли я быть? Если да, то как мне это заняться? Я не совсем уверен, как продвигать эту ветку.

Я уже писал об этом, но это было давно, и никто не ответил, поэтому я добавил дополнительную информацию о том, что, на мой взгляд, проблема может быть здесь.

Name already in use

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Uploads a directory to gh-pages. Perfect for use with Travis-CI deployments.

You can use Travis to automatically deploy your static website to GitHub pages.

Generate a GitHub token

Generate a GitHub token. Travis will use this to push to your repository on your behalf. You can use any name, but you can call it Travis CI. Keep this token somewhere safe; you can use it for any of your repositories that will need git-update-ghpages deployments.

Adding your token

Make sure Travis is already enabled on your repository. Go to your Travis’s repo’s settings page ( https://travis-ci.org/user/repo/settings ), and add your token there as GITHUB_TOKEN . Be sure to turn off the «show this in build log» option.

Alternatively, you can also use the Travis CLI tool to add this to your repo as a secure variable:

автоматически обновлять gh-страницы

У меня есть этот проект с настройкой gh-pages ветки.

Веб-контент внутри него был опубликован с помощью функции генератора gh-страниц.

На самом деле это просто README.md для index.html + макет.

Теперь я хотел бы, чтобы этот веб-контент синхронизировался с моими обновлениями.

На самом деле, функциональность gh pages требует прохождения веб-интерфейса github для запуска сборки. Действительно, я сделал тестовое изменение в своем файле readme, отправил его в master, но опубликованный веб-сайт остался прежним. См. коммит. Формулировка test не будет найдена в сайт

How do I get my gh-pages branch to update?

I was previously working on my newest GitHub Pages website. My website is a React app. I finally got the website to run about a month ago, but I got stuck on this issue of my website not automatically re-rendering when I push changes to GitHub. The only way I can get my website to re-render is to publish it, but I am pretty much certain that I am not supposed to publish frequently.

I think the issue is that I am not actually updating the gh-pages branch of my repository, and I’m not sure if I’m supposed to be. Should I be? If the answer is yes, then how would I go about doing this? I’m not really sure how to push that branch either.

I posted about this already, but it’s been a long time, and no one has responded, so I added some more information on what I think the issue might be here.

Chris's user avatar

7 Answers 7

I don’t think you should be pushing directly to your gh-pages branch. The gh-pages command pushes to it for you.

I took a look at the npm deploy script in your package.json, and I see you have "deploy": "gh-pages -d dist" . According to the gh-pages docs, when you run gh-pages -d dist , the gh-pages command will publish everything in the dist/ directory of your current branch to the gh-pages remote branch. And your site is served from the resulting build files that have been pushed to that gh-pages branch.

Читать:
Почему не заходит в авито

I also noticed at the end of the gh-pages docs that it says:

If gh-pages fails, you may find that you need to manually clean up the cache directory. To remove the cache directory, run node_modules/gh-pages/bin/gh-pages-clean or remove node_modules/.cache/gh-pages.

^^^ Those are actually faulty instructions. The first option should be node node_modules/gh-pages/bin/gh-pages-clean . The second option should be to remove node_modules/gh-pages/.cache (because the .cache lives in gh-pages , not the other way around).

You may want to try one of those cache-killing options if things are still not working as expected, even after you stop pushing to the gh-pages branch.

I think the issue is that I am not actually updating the gh-pages branch of my repository, and I’m not sure if I’m supposed to be. Should I be? If the answer is yes, then how would I go about doing this? I’m not really sure how to push that branch either.

Assuming your GitHub Pages site renders from gh-pages , then yes, that’s the branch where you should be making changes and it’s the branch that you should be pushing to GitHub.

I don’t know exactly what workflow you’re using, but a common way to make changes to a branch is to

  1. check it out with git checkout gh-pages ,
  2. make your changes,
  3. git add the changes you wish to commit, and
  4. git commit to create a new commit.

You can repeat steps 2–4 as necessary.

Once you’re ready to publish your new changes you can push gh-pages to GitHub. Again, I don’t know your exact workflow but a simple git push with gh-pages checked out is probably enough.

Chris's user avatar

I used the instructions at https://github.com/gitname/react-gh-pages to set up a gh-page. To update my React app that was made using create-react-app, I just have to run yarn build then yarn run deploy .

Lynne Daniels's user avatar

I had the same issue and tried a lot of complex online solutions. I found the following to work:

You could follow this instructions https://www.pluralsight.com/guides/how-to-create-react-application-and-deploy-on-github-pages to set up a gh-pagse. To update gh-pages, for me, I run this first:

it will be on set.

From the main/master branch type:

  • and your gh-pages will update.

This is the answer that github has for updating a react app.

Below is what the page basically states:

How to update React in GitHub pages:

Assuming you already have a GitHub page running with gh-pages and after you push your changes, you see them in your repo but the GitHub page is not being updated.

Keep reading the full guide or check out the quick solution in the Tutorial Page (If you wondering about the full-screen video in the tutorial page, check this guide to learn how to set a Responsive video in React)

In this sample we are using npm and our branch called main, if needed, change them according to your own settings. We already have a build directory — and if you don’t have one? no problem! just execute npm run build command (make sure the build folder it’s not listed in the .gitignore file). Let’s Start The solution is simple — we just need to update the build directory! In the terminal:

Make sure you are in the project folder and no other processes are running (to stop all processing in the terminal: Ctrl + c in Windows OR Cmd + c in Mac)

Deploy the build folder:

(If you are using GitHub in your code editor, you will see the build folder content being added to the Unstaged Changes — ready to be staged).

Похожие статьи