19

GitHub Pages allows each user to have one User Site (maybe a home page) and unlimited Project Sites.

When you set up your User Site, you must name the repo [username].github.io (where [username] is your GitHub username), and the URL is by default:

http://[username].github.io/

Any changes made to the master branch in your [username].github.io repo are uploaded to your User Site.

When you set up a Project Site, you can name the repo anything you want (let's call it [projname]). The URL is by default:

http://[username].github.io/[projname]

Any changes made to the gh-pages branch in your [projname] repo are uploaded to the Project Site.

My question is, what if in your User Site repository, you coincidentally have a folder that has the same name as your Project Site repository?

For example, say you have a file index.html inside a folder temp/ in your User Site repo bob.github.io. Then that page would be hosted online at

http://bob.github.io/temp/index.html

Now say you create a Project Site with repo name temp. In that repo, you have a file called index.html. Then when you push it to thegh-pages branch, would it be hosted online at

http://bob.github.io/temp/index.html

?

chharvey
  • 8,580
  • 9
  • 56
  • 95

3 Answers3

7

Github support response:

Yes, they would conflict. The url for Project sites will be username.github.io/project, and the url for a folder in a user or organization site would be username.github.io/project.

I would recommend that you either rename the directory or the repository name.

Shawn
  • 71
  • 1
  • 4
  • 2
    What exactly do you mean by "conflict"? If I have `file1.txt` in my User site `username.github.io/folder/file1.txt` and `file2.txt` in a Project `folder` site `username.github.io/folder/file2.txt` will they both be accessible at the corresponding URLs? – chharvey Nov 11 '14 at 18:20
  • To conflict they would have to be the same name and end up resolving to the same url. – Shawn Dec 15 '14 at 21:54
3

I just did the experiment of naming a new repo with the same name as a subfolder in my user site repo:

As a result the new repo took precedence over my personal site.

danielcaballero88
  • 343
  • 1
  • 2
  • 10
0

I also did a test keeping "mydocs" as one project repo (public activated with GH pages) and a directory "mydocs" in my .github.io repo. I just wanted to make sure if content is merged (appears in addition to project repo content)in the /mydocs directory. But it does not happen. It honours the repo content only, there is no merging of main site repo content under the / context.

Sagay
  • 31
  • 4