Code and repositories / Assets
Choose who can see your assets
Your code is private, but your public site needs its images, and your drafts must stay hidden. Make the assets public while the code stays private, and hide each draft until it is ready.
4 min read
By default, assets follow the access of the repository.
Who can open and who can list
| Repository | Who opens an asset URL | Who lists the assets |
|---|---|---|
| Public | Anyone | Anyone |
| Private | People with read access | People with read access |
| Private, with Assets are public on | Anyone with the URL | People with read access |
Note
A hidden asset has its own rule in all three cases. Only people with write access can list it and open its URLs. The person who uploaded its current version can also open it. Everyone else gets 404 Not Found.
Make the assets of a private repository public
You need admin access.
- Open the repository, then the Assets tab.
- In Who can open them, turn on Assets are public. It saves at once.

The General settings of the repository have the same switch, under Assets. There, click Save in the bar at the bottom after you turn it on.

From a terminal, run src asset visibility public. To make them private again, run src asset visibility private.
When the switch is on:
- Anyone with the URL of an asset can download it. Other sites can load it too.
- The code stays private.
- Hidden assets stay hidden.
- People without access still cannot list the assets. They open only the URLs that they have.
The assets of a public repository are always public. On its Assets tab, the switch is on, and you cannot turn it off.
Warning
A path such as images/logo.png is easy to guess. If a file must stay private, hide it.
Keep a draft hidden
You need write access.
- Upload the file. An upload to a new path is not hidden, so do the next step at once.
- In the Assets tab, click the name of the file, then click Hide. From a terminal, run
src asset hide images/draft.png. - When the file is ready, click Unhide, or run
src asset hide images/draft.png --unhide.
What a hidden asset does:
- It hides all its versions, pinned URLs too.
- A new version of it stays hidden.
- Browsers do not cache it.
Warning
If you hide an asset that was public, browsers keep their cached copies until the cache time ends. That is 1 minute for the URL, and up to 1 year for a pinned URL. Versions and caching explains the two URLs.
Done
Your site shows its images to everyone, and your code stays private. Only the people with write access see your drafts.
Attachments from people without write access
A person without write access attaches a screenshot to a comment. Screening reads the comment before others see it, so the file must not show before the comment does.
Each such file goes to attachments/ as a hidden asset:
- The person who uploaded it sees it in their own text.
- When screening or a maintainer shows the text, the files that the text links to show too.
- If screening or a maintainer rejects the text, its files stay hidden.
More rules for attachments:
- If you hide the text later, its files stay shown. Hide or delete them in the Assets tab, in
attachments/. - The same bytes are always one asset. If a person with write access attaches a file that is hidden in
attachments/, the file is shown. An upload from a person without write access never hides a shown file. - Files from people with write access are shown at once.
Add images and videos to issues and comments shows how people attach files.
Who can change assets
- Read access: list the assets and open their URLs. People who can comment also attach images and videos to
attachments/. - Write access: upload, make a version current, hide, unhide and delete.
- Admin access: turn Assets are public on or off.
Agents and CI jobs have their own rules. Upload from a script or an agent lists them.