Share Git file macro
The Share Git file macro allows you to add a Git file to the content of a Confluence page. The content of the macro will be kept up-to-date with the Git repository.
Last updated
The Share Git file macro allows you to add a Git file to the content of a Confluence page. The content of the macro will be kept up-to-date with the Git repository.
Last updated
The easiest way to share your Git files is to paste the link of your Git file into your Confluence page. URLs from supported providers are automatically converted to the 'Share Git file' macro.
URLs to public Git files are immediately visible. If the pasted URL is a link to a private Git file, you will have to edit the macro to share it on your behalf.
You can add the 'Share Git file' macro to a Confluence page by using the macro browser. Alternatively, you can start typing /share git
and Confluence will suggest to add the 'Share Git file' macro.
When editing the macro you will be presented with a text-field to fetch a Git file from a URL. When providing a valid URL, the macro will fetch the file and display a preview of it's contents. Then you can press the Share this file button to add the content to the Confluence page.
In order to display private Git files on a Confluence page, a person who is allowed to share private files must give permission to share this file. You do this with the share on my behalf button.
This links this person in Confluence to the Git file. That means the Git file will remain visible on Confluence as long as:
Using Auth 2.0 - this person in the repository continues to have access to this file , or until the sharing permission is revoked or taken over.
Using Shared Access Token - the configured access token has access to the file, or until the sharing permission is revoked.
Once you have shared a Git file you can revoke that share by editing the macro. You will be presented with a dialog similar to that of adding a Git file. This time you will see a button indicating that you can Revoke this share. Alternatively you can navigate to the shared Git files overview, where you'll find an overview of all your shared Git files.
When you paste a URL from a Git file that you don't have access to in the repository, Git for Confluence won't be able to display content. When fetching via the 'Share Git file' macro, you will also get a warning that you don't have the required permissions to view that file.
Since the macro is available on the page, somebody else who does have the required permissions to view the Git file can edit the macro and share the Git file on their behalf. After that everyone will be able to view the Git file.
When you paste a URL to a Git file that does not exist, it is not possible to render a file.
When fetching via the 'Share Git file' macro, you are not able to add the macro to your page. If you paste the link directly into the file, the link will remain visible and will not turn into a macro.