Changing Your Website URL
Changing your Website URL
When you create your GitHub Pages website for the first time, its URL is decided by your GitHub username, and the name of the repo you've created. For example, if your username is JacobWG
, and you named your repo bestcomic
, then the URL for your website will be http://JacobWG.github.io/bestcomic/.
There are two ways to change the URL for your web page:
Change your username or repo name
Assign a custom domain to your website
Changing your Username
Changing your username will change the part of the URL right before .github.io
. It will also change the username you use to log into GitHub, and you will have to relogin to GitHub Desktop.
To change it:
Click your icon in the top right corner of any GitHub page, then click Settings.
In the list of options on the left, click Account.
Click Change Username. Follow the steps GitHub gives you to complete the process.
Changing your Repo Name
Changing the name of your webcomic's repository will change the last part of your URL.
To change it:
From the main page of your repository, click Settings.
The first option in General Settings shows your repo name. Click in the text box, make your desired changes, then click Rename.
Moving to a Custom Domain
At some point, you will likely want to host your comic from a custom domain, so your readers don't have to keep going to your github.io URL. Fortunately, GitHub Pages supports this!
Create an A and CNAME Record for your Domain
The first thing you'll need to do is set an A and CNAME record in the DNS settings of your domain registrar's management page. The exact instructions depend on which registrar you've registered your domain with and is beyond the scope of this article. Most registrars will have their own help documentation telling you how to do this.
You will want to set the following values on your records. This is offered as a convenient reference, and is not definitive; the field names below may not match what you see on your registrar's website:
A
This record points your apex domain (e.g. bestcomic.com
) directly at the GitHub Pages servers. This record is technically optional, but recommended.
DNS name: empty string (it may look like
bestcomic.com.
in your settings)Values:
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
CNAME
This record points the www
subdomain (e.g., www.bestcomic.com
) to your GitHub Pages site. This record is required.
DNS name: www (it may look like
www.bestcomic.com.
in your settings)Canonical name: <username>.github.io. (e.g.
ryanvilbrandt.github.io.
)
You can leave fields like "TTL" as their default values.
GitHub provides more detail on DNS records and what values to enter for them. See Managing a custom domain for your GitHub Pages site.
Change your GitHub Pages Settings
From the main page of your repository, click Settings.
In the list of options on the left, click Pages. Find the Custom domain entry in the Pages settings.
Fill out the text field for the Custom Domain to match whatever custom domain you want to assign to your website, then click Save.
The page will reload with a blue banner that says Custom domain "<domain name>" saved.
Create a CNAME file in your Repository
In your repository, create a new file called CNAME
with no extension. In the file, add only a single line with your new domain, e.g. www.bestcomic.com
Last updated