Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy organization to github pages with --user-page flag #3039

Closed
johnazre opened this issue Nov 6, 2016 · 4 comments
Closed

Comments

@johnazre
Copy link

johnazre commented Nov 6, 2016

Please provide us with the following information:

OS?

Mac OSX (Sierra)

Versions.

angular-cli: 1.0.0-beta.19-3
node: 6.6.0
os: darwin x64

Repro steps.

In this order:

  • Created project with ng new newProject
  • Created repo on github
  • Added ssh remote origin on the command line
  • Pushed project to github
  • Tried ng github-pages:deploy. The build seemed to work, but then I got the error below.

The log given by the failure.

Error: Command failed: git push origin gh-pages:master
To git@github.com:something/something.github.io.git
 ! [rejected]        gh-pages -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:something/something.github.io.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:493:12)

When I try to pull, it says everything is up to date.

I am able to make it work by manually merging gh-pages into master, then add/commit/push that to Github.

@filipesilva
Copy link
Contributor

This is actually a rather unfortunate case... the way ng github-pages:deploy works is by making a new branch with only the contents of the dist/ directory.

Usually that branch is pushed up to gh-pages, a new remote branch. All is fine in that case. But on user and org pages, you have to push to master. And master is where your app code lives already... so when we push, there's a git error. You can't have both the built site and your project at the same time there.

So my recommendation is that you have your project proper in another branch that isn't master, for instance a new one called app.

I'd like to find a better way of doing this if there's one.

@rolyatsats
Copy link
Contributor

What about using a temp directory outside of the current project? This would allow use of the master branch as it would be a separate repo.

This could be a system temp directory or simply up one directory from the project. Maybe the directory name includes a unique timestamp integer?

For future updates, the existing remote github pages repo would be cloned into the temp directory first before the new dist files are copied, then pushed back.

As implied with temp, the directory would be deleted after deployment.

Thoughts?

@filipesilva
Copy link
Contributor

Closed via #4385.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants