Оглавление:
Статья последний раз была обновлена 04.03.2023
Publishing a Website on Bitbucket Cloud
You can use Bitbucket to host a static website. A static website contains coded HTML pages with fixed content. Websites hosted in this way have the bitbucket.org
domain in their URL, for example, http://tortoisehg.bitbucket.org
. Another example, is the site maintained by the Bitbucket Cloud tutorial that lists favorite quotes by Bitbuckians.
Publishing a static website on Bitbucket Cloud requires you to combine your account’s name with the bitbucket.org
domain suffix. So, your account’s name must be acceptable to your DNS service. Upper case characters and special characters are typically not acceptable. For example, if your account’s name is happy_cat
, you would need to create a new account with a username of happycat
to use this feature because underscores are not allowed in DNS hostnames. Your repository name would be happycat.bitbucket.org
and the published static website is reached by this URL: http://
happycat
.bitbucket.org
The following topics appear on this page:
Configure a Website for Hosting
To use this feature, do the following:
- Log into your Bitbucket account.
-
Create a repository and making sure to Name it using the following format:
accountname
.bitbucket.org
The repository name needs to include the trailingbitbucket.org
. For example, if your accountname istutorials
(1) your repository Name should be thistutorials.bitbucket.org
(2).
- Clone your repository to your local system.
- Create an
index.html
file in the repository root.Keep in mind the names are case sensitive; Bitbucket treats
index.html
andIndex.html
as different file names. Make sure your file is namedindex.html
– all lowercase. - Add
index.html
file to your repository, commit the change, and push the result to Bitbucket. - Navigate to the
http://
site.accountname
.bitbucket.orgFor example, if your username is is
tutorials
you would navigate tohttp://tutorials.bitbucket.org
. The system displays the HTML in the site’sindex.html
.
Technical Features and Limitations of this Feature
Static websites on Bitbucket support the following features:
- Embedding images and other media.
- Inclusion of JavaScripts in your HTML pages.
- Blog comments by embedding Disqus in your site.
This feature turns a repository into a plain static webserver that uses the repository’s root as the web root. Bitbucket does not support the use of HTTPS with this feature; you cannot log into the site. The system does not issue cookies for these domains. Server-side scripts or code are not supported. You cannot use PHP or other server-side scripting languages on the site.
Finally, Atlassian injects a rum.js
script into each Bitbucket website. This script captures internal web analytics and statistics.
Hosting Multiple Projects Under a Single Website
You may have multiple projects that you want to host from the same Bitbucket websites, you can do this by placing each project in a repository subdirectory. In this example, you would want to organize things such that you can point users to:
- http://accountname.bitbucket.org/subdir1forproject1
- http://accountname.bitbucket.org/subdir2forproject2
- http://accountname.bitbucket.org/subdir3forproject3
Each project sub-directory would act as a self-contained website with its own index.html
.
Bitbucket is forgiving with regard to trailing slashes: a request to http://accountname.bitbucket.org/projectX/
with result in projectX/index.html
being served (if such a file exists), regardless of whether the trailing slash is included in the URL.
Public and Private Repositories and Static Websites
The static website you create with this feature is just like any other website on the Internet — anyone with the URL (address) can visit and view your static website. The underlying Bitbucket repository can be a public repository or a private repository. This means if your Bitbucket repository is private, users can still visit and view the static website. The same is true if the underlying repository is public.
Was this helpful? Yes No
Have a question about this article?
https://confluence.atlassian.com/bitbucket/publishing-a-website-on-bitbucket-cloud-221449776.html
- Как узнать IP-адрес по MAC-адресу - 07.04.2023
- Пинг проходит, а страницы в браузере не открываются - 07.04.2023
- Что если сайт пингуется «извне», но не открывается из под «локалки»? - 07.04.2023