Git推送到gh-pages(更新被拒绝)

问题描述 投票:0回答:1

我有一个项目正在Github的gh-pages分支中从一个名为dist的文件夹中提供。我想出了如何从这个文件夹进行部署,并且在我尝试推送另一个版本之前一切正常。

首先,我承诺并推动原始大师。其次我添加并提交dist文件夹

git add dist && git commit -m "Pasta dist adicionada ao projeto"

最后我尝试推送到gh-pages

git subtree push --prefix dist origin gh-pages

这里是所有日志过程:

samuel@debian:~/Documentos/01 - WEB/Cipher/web$ git add dist && git commit -m 

"Formulário para contato na página Contato.html"
[master 022dcf6] Formulário para contato na página Contato.html
 2 files changed, 2 insertions(+), 2 deletions(-)

samuel@debian:~/Documentos/01 - WEB/Cipher/web$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean

samuel@debian:~/Documentos/01 - WEB/Cipher/web$ git push
Enter passphrase for key '/home/samuel/.ssh/cipher-deploy': 
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 452 bytes | 0 bytes/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To github.com:samu101108/cipher-transcritor.git
   c2944ca..022dcf6  master -> master

samuel@debian:~/Documentos/01 - WEB/Cipher/web$ git add dist && git commit -m "Formulário para contato na página Contato.html"
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

samuel@debian:~/Documentos/01 - WEB/Cipher/web$ git subtree push --prefix dist origin gh-pages
git push using:  origin gh-pages
Enter passphrase for key '/home/samuel/.ssh/cipher-deploy': 
To github.com:samu101108/cipher-transcritor.git
 ! [rejected]        4d627ffb7d871a68353d427d66a00fd917fe6639 -> gh-pages (non-fast-forward)
error: failed to push some refs to '[email protected]:samu101108/cipher-transcritor.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

那么......怎么了?

git deployment github-pages
1个回答
2
投票

我有一个解决方案!由于gh-pages分支是可以删除的东西然后我做了。之后我再次推送到子树,因此重新创建gh-pages分支并使用更新版本进行部署。按照我需要的命令来完成它。

$ git push origin --delete gh-pages
$ git subtree push --prefix dist origin gh-pages
© www.soinside.com 2019 - 2024. All rights reserved.