Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I am trying to hose a website using bitbucket that is built through Hugo

hdave1
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 7, 2022

My pipeline succeeds but I when I go to my website url, ir only shows a message saying "repository not available"

 

not sure what the issue is here but  shown below is my .yml file for the pipeline. fyi: running locally with Hugo does produce a website correctly, the issue is when hosting through bitbucket

here is my .yml file for reference:

 

image: klakegg/hugo:0.101.0-ext-ubuntu-onbuild

pipelines:
branches:
hugo:
- step:
script:
# Change working directory to 'hugo-src', a subfolder of root of the current branch (hugo).
- cd "${BITBUCKET_CLONE_DIR}"

# Update/Initialise any submodules in the current branch.
# This will clone the submodule contents into their directories within the pipeline environment.
- git submodule update --init --recursive

# Clone the master branch into the 'public' directory.
# This will enable updates to the master branch; namely the Hugo-generated output.
#- git clone -b main ssh://git@bitbucket.org/himanshu106/himanshudave.bitbucket.io public

# Remove the entire contents of the master branch.
# This ensures that any content that was deleted during the latest commit (hugo branch) is also purged.
#- rm -rf ./public/*

# Remove the '.git' file under any theme submodules.
# This is necessary to ensure that submodule files are also pushed to the master branch.
# Without this step, the Hugo build will fail to generate index.html, and other mandatory files.
#- rm -rf ./themes/*/.git

# Build the Hugo website in the 'public' directory.
- hugo version --verbose
- hugo --baseURL "https://himanshudave.bitbucket.io" --destination public --verbose
- ls -al ./public
# 'Minify' the build (optimize file sizes to improve load times)
#- minify -r -o ./public ./public

# Push the build output to the master branch.
# Authentication is achieved through SSH key generation (pipeline settings) and exchange (Bitbucket account settings).
- git config --global user.email "<email_removed>"
- git config --global user.name "<username_removed>"
- cd public && git status && git add . && git commit -m "Generated from $BITBUCKET_COMMIT" && git push

- echo "Finished!"

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2022

Hi @hdave1 and welcome to the community.

If you want to host a static website on Bitbucket Cloud, the name of the repository with the website must be the same as the workspace id of the workspace that owns the repo. Please have a look at the following documentation:

In your yml file you reference himanshu106/himanshudave.bitbucket.io

If the workspace id is himanshu106, then the repo name needs to be himanshu106.bitbucket.io instead of himanshudave.bitbucket.io

You can always change the workspace-id and in turn the repo name, if the workspace id you want to use is available.

The repository also needs to have a file called index.html in the root directory, in lowercase letters. I'm not sure if your repo already has that, if not, you will need to add it.

If you have any questions, please feel free to let me know.

Just a heads up, I removed the email and username from your post to comply with our privacy policy.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events