Skip to content

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

Closed

Description

@johnazre

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.

Activity

  1. filipesilva commented on Nov 16, 2016

    @filipesilva
    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.

  2. rolyatsats commented on Dec 10, 2016

    @rolyatsats
    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?

  3. filipesilva commented on Feb 3, 2017

    @filipesilva
    Contributor

    Closed via #4385.

  4. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  5. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions