-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Environment
OS: ubuntu 17.10
Node: v6.11.4
npm: 5.6.0
yarn: 1.3.2
(OS, Node, npm, yarn)
Steps to Reproduce
-
publish use local project to remote use : yarn run publish-gh-pages command, first time is ok, but when checkout the second time fail;
-
error info shows:
$ docusaurus-publish
master
generate.js triggered...
feed.js triggered...
feed.js triggered...
Site built successfully. Generated files in 'build' folder.
Cloning into 'fartpig.github.io-master'...
git clone ok
Note: checking out 'origin/master'.You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:git checkout -b
HEAD is now at 254a030... Delete CNAME
fatal: A branch named 'master' already exists.
fatal: could not set upstream of HEAD to origin/master when it does not point to any branch.
Error: Git checkout master failed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. -
when i git log the branch , they has the same SHA code between the detached commit and master branch.
When I note the code :
if (shell.exec(`git checkout origin/${DEPLOYMENT_BRANCH}`).code !== 0) {
if (shell.exec(`git checkout --orphan ${DEPLOYMENT_BRANCH}`).code !== 0) {
shell.echo(`Error: Git checkout ${DEPLOYMENT_BRANCH} failed`);
shell.exit(1);
}
} else {
if (
shell.exec(`git checkout -b ${DEPLOYMENT_BRANCH}`).code +
shell.exec(`git branch --set-upstream-to=origin/${DEPLOYMENT_BRANCH}`)
.code !==
0
) {
shell.echo(`Error: Git checkout ${DEPLOYMENT_BRANCH} failed`);
shell.exit(1);
}
}
in docusaurus-publish.js , then it works. I thinks this should have a branch check before operation.