Can't use Git Pages - html

TLDR: GitHub Pages isn't working.
I have a little knowledge on GitHub and tried multiple fixes to no avail. One repository is only showing readme file contents.
Please explain in lamest terms.
New to web development, I finally was able to complete my first site, but I'm unable to actually deploy the files for some reason; please forgive me, I literally have no idea what any of the git terminologies are.
I purchased a pro subscription in order to keep the repository private and the site public.
Every file is present in what seems to be the main root directory, but nothing is being actually presented.
I've created two different repositories in an effort to fix this, as I've seen different methods are available.
The first repository includes a README file because I was originally instructed to do so, however, all the site link does is present that README file's contents;
I also attempted to add a permalink fix within the file, but all it did was add that text to the other text presented.
The second repository in question literally greets me with nothing but a 404 error.
The solution I tried for the second repository was to have the repository name share my username as well since that seems to be where the site's link originates, but no present changes have occurred.
Finally, the waiting game solution hasn't beared any fruit yet either aside from updating the README file's contents.
All help is very much appreciated.

Check first:
Your GitHub repository name, which depends on the type of GitHub Pages you are creating
If you're creating a user or organization site, your repository must be named <user>.github.io or <organization>.github.io.
your GitHub Pages Publishing source
If you use the default publishing source for your GitHub Pages site, your site will publish automatically. You can also choose to publish your site from a different branch or folder.
You can add more pages to your site by creating more new files.
Each file will be available on your site in the same directory structure as your publishing source.
For example, if the publishing source for your project site is the gh-pages branch, and you create a new file called /about/contact-us.md on the gh-pages branch, the file will be available at https://<user>.github.io/<repository>/about/contact-us.html.

Make sure you have GitHub Pages enabled for every repository and that it's set to the branch you want to publish by checking your Pages settings at github.com/<user>/<repo>/settings/pages. If enabled, there should be a link on that page that takes you to the site.

Related

How to post assignment .io on github?

guys I'm supposed to upload assignment for this online course..
I followed the tutorial along exactly but something is not working properly.
https://zwc1625.github.io/coursera-web24/ is the where my repo is published and it's working fine.
but,
https://zwc1625.github.io/coursera-web24/mod_2/
where mod_2 is the assignment folder containing 1 html and 1 css file,
when I try to type in this address in the url 404 comes up
My local drive is up to date with the github repo
Help. New and very frustrated with github, I'm spending so much time with this and making no progress.
Github will serve a few specifically named files automatically, like 'index.html', 'readme.md' or 'readme'. Most servers will look in the specified folder (https://zwc1625.github.io/coursera-web24/mod_2/) for files named: 'index' or 'default' with a specific extension like 'html', 'asp', 'xhtml'.
As the file in your folder 'mod_2' is called 'module2HTML.html' it will not get served automatically. Consequently, if you want to open that file in your browser, you will need to name it specifically in the URL you enter in the browser addressbar: https://zwc1625.github.io/coursera-web24/mod_2/module2HTML.html
Furthermore, when you did name your file 'index.html' it may be possible that there is a time lag between your 'commit' and Github being able to serve your page. Some patience may be required....

Why won't Github Pages serve my documentation?

I use sphinx to build html documentation, and am in the middle of open-sourcing some of my company's private repos.
Internally, we serve documentation from an S3 bucket through Cloudfront so we can put access controls in front of it. But for open source, I figured publishing via Github Pages would be the path of least resistance.
However, I cannot get the service to work correctly.
Here is my repo, with my index.html in the /docs folder.
Here is the site, which is not applying any of the linked css, and with all page links broken.
I tried to isolate the issue by making a test repo with just the built documentation, and publishing from master.
As you can see, this one does not even try to serve the index.html, I just get a 404 page.
These files work both locally and when serving from AWS, so I'm a little at a loss for why Github Pages is not serving it correctly. I feel like I must be making some sort of dumb oversight. If anyone with more experience could take a look and point me toward the error of my ways I would really appreciate it. I'm a backend engineer for the most part so website logic is a little outside my normal wheelhouse. Thanks in advance!
To anyone else running into the same thing, I figured it out. Because I am pre-building the site in my CI/CD pipeline, I don't need jekyll to build the site for me, and need to add an empty config file for it.
From [here][https://www.docslikecode.com/articles/github-pages-python-sphinx/]:
Next, you set up the .nojekyll file to indicate you aren’t using
Jekyll as your static site generator in this repository.
Thank you for your help!
You need a _config.yml, and you need to enable github pages on Master for the repo (go to settings). After that, you also need a Gemfile it the following:
source 'https://rubygems.org'
gem 'github-pages'
Normally, the GitHub pages site needs to be in the root, and yours looks like it's in a /docs folder, so I'm sure you can Google how to do that. It might not be possible though with GH pages, I'm not sure.
If it must be a subfolder and not the root of the project maybe something like this would work: https://gist.github.com/cobyism/4730490
Heres whats in my _config: for barebones sites:
permalink: pretty
sass:
sass_dir: _scss
style: compressed
I'm sure you can leave sass out

Setting a GitHub pages site from a Jekyll-generated page

I cannot setup a new Jekyll-based GitHub pages site based on the tutorials I've read. Here is the full list of steps I took:
Ran jekyll new jek_test. This created a new dir.
Used GitHub desktop to create a git repository in that dir, then pushed it to a new git repository, jek_test.
In the project settings GitHub Pages panel, I choose master branch as source.
So far this had no effect I could see. Navigating to https://gadial.github.io/jek_test/ yielded a 404 error.
I added the following two lines to the projects Gemfile:
source "https://rubygems.org"
gem "github-pages", group: :jekyll_plugins
Now, after pushing to GitHub, the https://gadial.github.io/jek_test/ link is working, but the page loaded is obviously incorrect; the CSS is not loaded, the links are wrong, etc.
I guess I am missing several crucial steps, but all the tutorials I've found either go "simply push it and everything will be ok", or seem to assume I am not using a Gem-based theme, meaning all the layouts, css files etc. are explicitly stored in the _layouts directories etc.
Am I going about this the right way? What is the simplest method to get a Jekyll-generated site up and running on GitHub pages?
You are using minima which is the default so, that's not the issue but, if you have a look at your about.md you'll see that it is looking for a layout called page. You currently don't have a _layouts folder
Try creating a folder called _layouts and create a layout in that called page.html with however you want it to display the contents of all files with layout : page
The default page.html can be found here.
You will need to change url to "https://gadial.github.io" and baseurl to "/jek_test".
If this two attributes are not set up properly, Jekyll won't know where to look for your resources.

Github pages: why my site has different styles after fork?

I'm trying to get a Jekyll site on GitHub without having to locally install Jekyll, so I just browsed this list until I found a couple themes I liked and then tried forking them (I intend to edit and customize the files in the browser, without having to clone a local repository). But I keep getting a different version from what I fork.
For instance, I forked https://github.com/codeasashu/hcz-jekyll-blog, and from the live demo I expect it to look like this:
However, right after forking (no changes made to files yet) I get this:
The same happened with other themes. What's wrong?
Do check if the empty base URL has any link to what you see: codeasashu/hcz-jekyll-blog/blob/master/_config.yml.
Note that, according to issues/15, the gh_pages branch of that repo acts as a demo, not the master branch. In gh_pages branch, there is a baseurl.

How to see an HTML page on Github as a normal rendered HTML page to see preview in browser, without downloading?

On http://github.com developer keep the HTML, CSS, JavaScript and images files of the project. How can I see the HTML output in browser?
For example this: https://github.com/necolas/css3-social-signin-buttons/blob/master/index.html
When I open this it doesn't show the rendered HTML of the code of author. It shows the page as a source code.
Is it possible to see it as rendered HTML directly? Otherwise I always need to download the whole ZIP just to see the result.
The most comfortable way to preview HTML files on GitHub is to go to https://htmlpreview.github.io/ or just prepend it to the original URL, i.e.: https://htmlpreview.github.io/?https://github.com/bartaz/impress.js/blob/master/index.html
If you don't want to download an archive you can use GitHub Pages to render this.
Fork the repository to your account.
Clone it locally on your machine
Create a gh-pages branch (if one already exists, remove it and create a new one based off master).
Push the branch back to GitHub.
View the pages at http://username.github.io/repo`
In code:
git clone git#github.com:username/repo.git
cd repo
git branch gh-pages
# Might need to do this first: git branch -D gh-pages
git push -u origin gh-pages # Push the new branch back to github
Go to http://username.github.io/repo
🚩 Message from RawGit's creator and owner on https://rawgit.com:
RawGit has reached the end of its useful life
October 8, 2018
RawGit is now in a sunset phase and will soon shut down. It's been a fun five years, but all things must end.
GitHub repositories that served content through RawGit within the last month will continue to be served until at least October of 2019. URLs for other repositories are no longer being served.
If you're currently using RawGit, please stop using it as soon as you can.
When I tried to use it, I got:
403 Forbidden
RawGit will soon shut down and is no longer serving new repos. >> Please visit https://rawgit.com for more details.
You can use RawGit:
https://rawgit.com/necolas/css3-social-signin-buttons/master/index.html
It works better (at the time of this writing) than http://htmlpreview.github.com/, serving files with proper Content-Type headers.
Additionally, it also provides CDN URL for use in production.
It's really easy to do with github pages, it's just a bit weird the first time you do it. Sorta like the first time you had to juggle 3 kittens while learning to knit. (OK, it's not all that bad)
You need a gh-pages branch:
Basically github.com looks for a gh-pages branch of the repository. It will serve all HTML pages it finds in here as normal HTML directly to the browser.
How do I get this gh-pages branch?
Easy. Just create a branch of your github repo called gh-pages.
Specify --orphan when you create this branch, as you don't actually want to merge this branch back into your github branch, you just want a branch that contains your HTML resources.
$ git checkout --orphan gh-pages
What about all the other gunk in my repo, how does that fit in to it?
Nah, you can just go ahead and delete it. And it's safe to do now, because you've been paying attention and created an orphan branch which can't be merged back into your main branch and remove all your code.
I've created the branch, now what?
You need to push this branch up to github.com, so that their automation can kick in and start hosting these pages for you.
git push -u origin gh-pages
But.. My HTML is still not being served!
It takes a few minutes for github to index these branches and fire up the required infrastructure to serve up the content. Up to 10 minutes according to github.
The steps layed out by github.com
https://help.github.com/articles/creating-project-pages-manually
I read all the comments and thought that GitHub made it too difficult for normal user to create GitHub pages until I visited GitHub theme Page where its clearly mentioned that there is a section of "GitHub Pages" under settings Page of the concerned repo where you can choose the option "use the master branch for GitHub Pages." and voilà!!...checkout that particular repo on https://username.github.io/reponame
Also, if you use Tampermonkey, you can add a script that will add preview with http://htmlpreview.github.com/ button into actions menu beside 'raw', 'blame' and 'history' buttons.
Script like this one:
https://gist.github.com/vanyakosmos/83ba165b288af32cf85e2cac8f02ce6d
I have found another way:
Click on the "Raw" button if you haven't already
Ctrl+A, Ctrl+C
Open "Developer Tools" with F12
In the "Inspector" right-click on the tag and choose "Edit HTML"
Ctrl+A, Ctrl+V
Ctr+Return
Tested on Firefox but it should work in other browsers too
If you have configured GitHub Pages you can get your public url like as:
https://<username>.github.io/<repository>/index.html
where <username> & <repository> will be the placeholder for username & repo name respectively
So, the result will be like this:
http://necolas.github.io/css3-social-signin-buttons/index.html
If it is an organization with GithubPages enabled in all the repositories it will be something like:
https://<org>.github.io/<repository>/
Two approaches (for public repositories) worked well for me: both VERY SIMPLE and ABLE TO RENDER COMPLEX HTML PAGES with links to local CSS files and local JAVASCRIPT/VUE files.
METHOD 1 - With GitHub pages
To set up, go to: https://github.com/YOUR_ACCT_NAME/YOUR_REPO_NAME/settings/pages (see screen shot below)
Example of my original HTML page on the repo: https://github.com/BrainAnnex/life123/blob/main/experiments/life_1D/diffusion/diffusion_1.htm
How it looks rendered: https://brainannex.github.io/life123/experiments/life_1D/diffusion/diffusion_1.htm Notice how all the styling, graphics and interactive controls are all good :)
METHOD 2 - With free service raw.githack.com
Go to https://raw.githack.com/ and enter the full URL of yourpage (including the "/blob" part); e.g. https://github.com/BrainAnnex/life123/blob/main/experiments/life_1D/diffusion/diffusion_1.htm
Then the site generates 2 links that work quite well :)
A good alternative if GitHub pages were to become unavailable!
This isn't a direct answer, but I think it is a pretty sweet alternative.
http://www.s3auth.com/
It allows you to host your pages behind basic auth. Great for things like api docs in your private github repo. just ad a s3 put as part of your api build.
If you are using an enterprise Github, you might not want to have a public facing github pages. One thing that worked for us is to:
For a HTML file in: https://github.private-repo.com/team/project/blob/master/order.html
Following is the URL that opens in a browser and retrieves the latest file as HTML:
https://github.private-repo.com/pages/team/project/order.html