When the code changes in the repository, the commit hash will differ from the one stored in the macro and Git snippets will try to show the correct snippet, even though the line numbers might have changed. The commit hash is automatically inserted when you paste a URL. The line numbers will be extracted automatically from the URL, but you can change them afterwards at any time. You should now see the selected code as a snippet in the macro preview. Then go to a Confluence page, add the Git snippet macro and paste the URL you just copied. To add a snippet, browse to a file on the web frontend of Bitbucket Server or Github, select the lines you want to display in Confluence (if you don't select the lines, the whole file will be displayed) and copy the URL. With the Git snippet macro, you can insert code from Bitbucket Server or Github into a Confluence page. Then go to Confluence Administration → Git Snippets Settings and insert your Gitlab URL and the token. All you need to do is obtaining an access token that will be used to authenticate all Confluence requests (only read permissions are required). You can use Git Snippets with both Cloud and on-premise version of Gitlab. Then go to Confluence Administration → Git Snippets Settings and insert your token. Git Snippets will need a personal access token, you can create with your Github account. In order for Git Snippets to work with Github, you need a Github account with which the Git Snippets macro will make the requests to get the code from Github. Create a new password and check the Read permission for repositories.Ĭopy the generated password and go to Confluence Administration → Git Snippets Settings and insert your username and app password in the section. Log in to and go to Settings → App Passwords. No steps are required to use public repositories from .įor private repositories you need to add a Bitbucket username and app password. Then go to Confluence Administration → Git Snippets Settings and insert your token together with the address of your Bitbucket Server instance. If you can't create an Application Link to your Bitbucket Server instance, or want to make Git Snippets available for anonymous users, you can also configure a Bitbucket Server access token. To make Git Snippets use a such a token, you need to go to your Bitbucket instance Manage Account → Personal Access Tokens and create one. After that, the users will get a one-time authorization message when they want to see or add a Git snippet if they haven't authorized Bitbucket yet. Go to the Confluence Administration → Application Links and follow the Documentation to create an Application Link to Bitbucket. Note: If both an Application Link and an Access Token are configured for a Bitbucket Server instance, your users will be able to choose between the two in the Git Snippets macro. Git Snippets requires an Application Link or an Access Token in order to work with Bitbucket Server. Git Snippets allows you to include pieces of code from your Git repository into Confluence pages.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |