If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Multiple webhosting repositories

Started by alvaroamdo, Jan 28, 2023, 12:17 AM

Previous topic - Next topic

alvaroamdoTopic starter

Hi there! The question is about hosting on Github – specifically, whether it's possible to host a completely different project with a different repository on the same site where there's already hosting set up (username/username.github.io/project/index.html).

I understand that you've tried to create a second repository but encountered an error because the name was already taken. Have you considered using a different username for hosting.gihub.io?
  •  


Lechlak

To host the contents of a repository on Github, you can create a "gh-pages" branch within each repository. Once the branch is set up, the content can be accessed at https://username.github.io/repository-name/.

It's worth noting that this method allows for hosting of separate projects in their own repositories, regardless of the contents of "username.github.io". This means you can have your own personal business card website within the repository named "username.github.io", while hosting any additional projects in their own separate repositories.
  •  

kulwantnagi

Hosting allows you to do several things such as creating links and redirects to pages from another repository on the original one, renaming or deleting the original repository, and setting up "hosting" on your domain while providing subdomains.

However, it's important to note that using Github resources in an inappropriate way may not be allowed. While it's not clear what you're trying to do exactly, it's possible that Github may try to stop you if they view your actions as misuse of their resources.
  •  

Dodger

If you're looking for the right option for hosting websites, it can be helpful to compare your choices. Here are a few web hosts to consider: rockhoster.com, snaphost.com, and netshop-isp.com.cy.

All three options offer powerful servers that are capable of running business applications quickly and efficiently. This means you can expect a reliable hosting experience with any of these providers.
  •  

webwrappedup

It's unclear if adding another URL in .git/config under [remote "origin"] can achieve the desired outcome from the console, but it is a potential solution for ensuring proper functionality of the handles.

By doing so, synchronous pushes in two directions become possible. This means that changes made locally can be pushed to the remote repository, and vice versa.

If you need any further assistance or clarification on how to achieve this, don't hesitate to let me know!
  •  

oqvjAcourseTors

Yes, you can host multiple projects on GitHub Pages utilizing different repositories. However, GitHub Pages builds a public website for the users, organizations, or projects on GitHub from a specific branch and repository. The way the projects are hosted depends on two types of pages: user pages and project pages.

User or Organization pages: Content from the main branch of your <username>.github.io repository will be used to build and publish the GitHub Pages site. The website URL format for User or Organization pages is https://<username>.github.io.

Project Pages: Content from a <branch> (usually, gh-pages or main branch) is used from your project repository (<repository_name>). The URL for these pages looks like https://<username>.github.io/<repository_name>.

If you already have a repository set up for GitHub Pages (say <username>.github.io), this essentially creates a User or Organization pages site. If you then wanted to create a completely different project hosted on GitHub Pages, you would create a new repository with a new name. When you push your content to the gh-pages or main branch of this new repository, it will be available at a URL like https://<username>.github.io/<new_repository_name>.

This way, you may have one User Pages site and multiple Project Pages sites, each with entirely different content, hosted from separate repositories under the same GitHub account or organization.

Important note: To host website content on GitHub Pages, the repositories need to be public, or you need to have a paid GitHub account that allows private repository hosting for GitHub pages. So, always verify if your repository settings meet the conditions for Github Pages publishing.

Please let me know if you need further clarification!

You would have to create a new GitHub account with a new username to create another User Pages site (https://<new_username>.github.io) to host different content. However, keep in mind that doing so just to manage different projects might not be the best solution, as it actually fragments your profile and project management. The Project Pages method described above usually should suffice.

In summary, one GitHub account/username can host multiple Git repositories, each of which can be a different project website. For instance, if your GitHub username is "myusername", you could have multiple different project repositories associated with your account:

the repository "myusername.github.io" would contain your main GitHub Pages site, and its website would be accessible at "https://myusername.github.io".
a second repository named "project1" would have your project website, and its website would be accessible at "https://myusername.github.io/project1".
a third repository named "project2" would have another project website, and its website would be accessible at "https://myusername.github.io/project2".
...and so forth. Every project will be located in its repository and has its specific URL based on its repository name. Therefore, there should not be any problem related to the repository name being taken already, unless you're trying to create two repositories with the same name under the same account (which is not allowed).

If you want to publish a repository other than "<username>.github.io", go to that repository's settings and find the GitHub Pages section, and enable it. By default, it will probably use the "main" branch, but you can change it to a different branch if needed.

It's worth noting that these project websites are static (HTML, CSS, JavaScript, and images) and served by a CDN. That means you won't have server-side processing (PHP, Python, Node.js servers, etc.) for these GitHub Pages sites.

A helpful tip: you can use Jekyll (a static site generator supported natively by GitHub Pages) to create blog-like pages or full-fledged websites out of Markdown files. You can structure your website however you want by using custom layouts and includes, or by using predefined themes.


let's consider a step-by-step approach to host a new project on GitHub Pages if you're already hosting another:

Step 1: Create a new repository for your new project.

For this, head over to your GitHub profile, click on the 'Repositories' tab, and then click the green 'New' button at the top right.
Step 2: Name your project.

Give your repository a name that reflects the nature of your project. This name will be a part of the URL where your new project will be hosted (in the format https://<username>.github.io/<repository_name>).
Step 3: Initialize it with a README file (if needed).

You can select "Initialize this repository with a README" while creating the repository. This creates an initial commit for your project.
Step 4: Push your project files to this repository.

Once the repository is created, you can clone it to your local system, add your project files, and push these files back to the repository. Alternatively, you could simply drag and drop or choose files directly in the repository on GitHub's web interface, then commit them.
Step 5: Enable GitHub Pages for this repository.

After pushing your project files to this repository, head over to the settings of this repository. Scroll down to the GitHub Pages section, choose the branch where your project lives (usually the main branch), and save.
After a few moments, your new project will be available at https://<username>.github.io/<repository_name>.

Remember, for GitHub pages, your HTML entry point should be an index.html file in the root of your project repository (or in the root of your /docs folder, depending on your configuration).

Multiple such repositories can be created for various different projects, and they all can be hosted at their respective URLs. Just keep in mind they will all be static websites - GitHub Pages doesn't support server-side operations, like processing forms.

As a note, you can also add a custom domain to these sites if you own one. You'd set this up in the same GitHub Pages section in the repository settings and then add the necessary records to your domain name's DNS settings.

Customizing the look and feel of these sites, adding a blog, navigation, and many other features can be achieved using Jekyll, the static site generator that is fully integrated with GitHub Pages. That said, you're not at all limited to using Jekyll - any static site generator will work, or you can just write plain old HTML, CSS, and JavaScript!
  •  

naizsmile

The user repo (username.github.io) is a singleton - only one per user or org. Trying to clone that under a different repo name is a rookie mistake. Instead, create separate repos for each project and call them whatever you want, just avoid the reserved username.github.io.

Then, your URLs will be username.github.io/project1, username.github.io/project2, etc. If you want a completely different domain or user namespace, sure, register another GitHub account, but that's overkill for most use cases.
  •  



If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...