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

Deploying Github Page #720

Closed
piotrromanowski opened this issue May 11, 2016 · 13 comments · Fixed by #772
Closed

Deploying Github Page #720

piotrromanowski opened this issue May 11, 2016 · 13 comments · Fixed by #772
Assignees
Labels
effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix

Comments

@piotrromanowski
Copy link

piotrromanowski commented May 11, 2016

When you run the command
ng github-pages:deploy
and the project successfully creates a branch on your github account, you receive message that says
Deployed! Visit https://${userName}.github.io/${projectName}/
and
Github pages might take a few minutes to show the deployed site.
however the site is actually never deployed. It just creates the "gh-pages" branch on that repository.

@filipesilva
Copy link
Contributor

filipesilva commented May 11, 2016

Heya,

I think this is related to (but perhaps not fully caused by) you using a user page instead of a project page.

Basically, when you do a user page, the generated content must be in the master branch, and to be honest that case isn't well covered yet.

Can I ask you to try again with a different project name?

Meanwhile I'll work on both enabling and documenting the user page scenario.

@filipesilva filipesilva self-assigned this May 11, 2016
@filipesilva filipesilva added type: bug/fix effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels May 11, 2016
@EmmanuelTsouris
Copy link

EmmanuelTsouris commented May 13, 2016

Not sure if this is related, but I was able to successfully deploy to github pages using ng github-pages:deploy --message "Optional commit message"

After deployment, I saw a blank page with a bunch of errors in the console. I figured it was related to the base href, so I used the dynamic method outlined in the docs.

<script>document.write('');</script>

That fixed my blank page. https://emmanueltsouris.github.io/ng2-MediaBrowser/

@EmmanuelTsouris
Copy link

EmmanuelTsouris commented May 13, 2016

I seem to recall that there was also an anomoly with the link and the base href when I first published to github pages. Somehow there was an extra dash in the name.

So my project ng2-MediaBrowser had ng2-media**-browser in the base href (was also shown to me by the cli output). When I navigated to the url, I saw a 404. When I noticed the extra dash, I looked at my repo settings, saw that the correct page url was actually .../ng2-MediaBrowser and not .../ng2-Media-**Browser

Not sure where that extra dash came from, if it was my typing or a bug in the cli. I'll run it again with a similar project name when I have a chance.

@piotrromanowski
Copy link
Author

@EmmanuelTsouris Thanks for the suggestions I'll have another look! I'll also checkout your project to compare to see what I possibly did wrong

@filipesilva
Copy link
Contributor

@EmmanuelTsouris I'm glad to hear the feature worked for you! Not too sure of the extra dash issue, can you tell me your results with the new project?

@piotrromanowski I put up a PR that should allow you to easily push a user/org page (instead of a project page), you can find it here: #772

It also fixes a current bug that completely breaks the deploy process.

@EmmanuelTsouris
Copy link

EmmanuelTsouris commented May 15, 2016

@filipesilva I tested it again with a new project, this time I hadn't created the github project beforehand.

I created a project
ng new ng2-TestProject.

  • The folder name is ng2-TestProject
  • package.json has ng2-test-project
  • app component is ng2-test-project.component.ts, etc ..

I did a commit (no remote origin set yet), and then tried to do a github-pages deploy

  • It creates a github project named ng2-test-project
  • failed due to some token issue, access denied

Now I'm having issues with the token, I created a token initially with just the public repo access, but was getting access denied messages, so tried a few different extra perms, none seemed to work.

When I did this all before with my other project, I had created the project using the same name as the folder and added it as origin before doing the github-pages deploy. Which may be why it worked, and why the base href had the dash (but my project folder didn't have a dash).

Hope this helps

@filipesilva
Copy link
Contributor

@EmmanuelTsouris hm, odd that it fails with a token issue after the project is created on github... The token is solely used to create the github repo, so I wouldn't expect it to be used in any way after that.

Can you copy paste the error you got? If it's something like there are no changes, deploy aborted that it is actually the issue my PR is meant to fix.

@EmmanuelTsouris
Copy link

EmmanuelTsouris commented May 15, 2016

@filipesilva here's the error, it was a classic missing key in git:

Command failed: /bin/sh -c git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

There was a permissions error during git file operations, please close any open project files/folders and try again.
You might also need to return to the master branch manually.

I [stepped through my git config](https://help.github.com/articles/error-permission-denied-publickey/ to).
ssh-add -l showed no identities. So my github generated identity wasn't being used. I fixed the identity/key issue, and then retried the github-pages deploy. The project published successfully as https://emmanueltsouris.github.io/ng2-test-project/

Not an issue with angular-cli, just git being flakey with using the Github Mac generated github_rsa

@filipesilva
Copy link
Contributor

@EmmanuelTsouris awesome, glad to hear it now works well! I like the message on the page as well :D

@priyeshn
Copy link

priyeshn commented Feb 2, 2017

Getting "Failed to create GitHub repo. Error: 401 Unauthorized" when tries to deploys angular 2 app to my organization guthub page . Asking for a token and fails with 401

ng github-pages:deploy

? Please enter GitHub token you just created (used only once to create the repo):
? and your GitHub user name:
Failed to create GitHub repo. Error: 401 Unauthorized

@priyeshn
Copy link

priyeshn commented Feb 2, 2017

@filipesilva Please help .
Getting "Failed to create GitHub repo. Error: 401 Unauthorized" when tries to deploys angular 2 app to my organization guthub page . Asking for a token and fails with 401

ng github-pages:deploy

? Please enter GitHub token you just created (used only once to create the repo):
? and your GitHub user name:
Failed to create GitHub repo. Error: 401 Unauthorized

@EmmanuelTsouris
Copy link

@priyeshn sounds like a GitHub command line issue. Have you looked at https://help.github.com/articles/creating-an-access-token-for-command-line-use/

clydin pushed a commit that referenced this issue Jun 5, 2018
PR #906 updated the app schematics to display the name of the app in the title,
so the e2e test has to be fixed.
The prefix is now useless (it was introduced by #720 to fix the e2e test when it was using prefix),
and has been removed.
hansl pushed a commit that referenced this issue Jun 6, 2018
PR #906 updated the app schematics to display the name of the app in the title,
so the e2e test has to be fixed.
The prefix is now useless (it was introduced by #720 to fix the e2e test when it was using prefix),
and has been removed.
hansl pushed a commit that referenced this issue Jun 6, 2018
PR #906 updated the app schematics to display the name of the app in the title,
so the e2e test has to be fixed.
The prefix is now useless (it was introduced by #720 to fix the e2e test when it was using prefix),
and has been removed.
@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.
Labels
effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants