Setting up a Git repository in Crucible
This page describes how to use Crucible's native repository access to connect to a Git repository. The process for doing this depends on where the Git repository is hosted – connecting to a Git repo that is hosted in Bitbucket Server is much easier.
This native access uses a Fisheye component (without requiring a Fisheye license), which is why the description below refers to Fisheye in places. See What happens if I decide to stop using Fisheye with Crucible for more information.
Crucible interacts with Git repositories by executing the Git command in a separate process. Hence, the server running Crucible needs to have Git installed. Crucible indexes Git repositories by making a private, bare clone of your repository within Crucible's cache area. It uses this private clone for most Git operations. See Git manifest for more information about indexing Git repositories.
See the Supported platforms page for the version of Git that is required by the server running Crucible.
Git repositories hosted in Bitbucket Server
When Bitbucket Server is integrated with Fisheye:
- You can easily add Git repositories to Fisheye. The repository behaves just like a native repository in Fisheye, so your team gets all the benefits of Fisheye indexing, browsing and searching.
- The repository becomes available to Crucible (when integrated), so you can perform in-depth code reviews for changes in the repository.
- When you add a Bitbucket Server repository to Fisheye, a push to the repository will by default automatically trigger Fisheye to run an incremental index. No further configuration is required – you don't have to configure polling for new commits, or set up dedicated Fisheye web hooks in your Bitbucket Server instance.
You'll need to have an account in the Bitbucket Server instance, as well as permission to view the repository that you want to add.
- Click the 'cog' menu in the Fisheye header, and choose Administration (you'll need to be logged in as an administrator to see this link).
- Click Repositories (under 'Repository Settings').
- Click the Bitbucket Server repositories tab, and authenticate with Bitbucket Server if necessary.
- If multiple instances of Bitbucket Server are connected to Fisheye, use the Bitbucket server list to choose the instance of Bitbucket Server that hosts the repository you wish to add.
- Optionally, type a filter pattern to restrict the list of displayed repositories to those with a matching name, key or project.
- Click Add for each repository that you wish to add to Fisheye.
- If the name of repository conflicts with already existing one, you will be asked to specify a different name.
Starting with Fisheye version 4.2, regular users granted the 'Can add repository' permission can add repositories using the Bitbucket Server repositories tab. Note that they can see only Fisheye repositories they have admin permission for.
When adding new repositories, Fisheye will prevent the creation of a repository using a name that already exists – Fisheye will prompt you for an alternative name.
When you add a Bitbucket Server repository:
- Fisheye creates a read-only SSH key and adds that as an access key to the repository in Bitbucket Server. If this operation fails, the key will be added as a user key to your profile in Bitbucket Server. You can check if an access key was added by viewing the repository's settings in Bitbucket Server. See Using SSH keys to secure Git operations in the Bitbucket Server documentation for more information.
Git repositories hosted elsewhere
When adding or managing a Git repository, you can do the following:
- Define repository details, as described below.
- Set Fisheye's repository options.
To add an external Git repository to Fisheye:
- Click the 'cog' menu in the Fisheye header, and choose Administration (you'll need to be logged in as an administrator to see this link).
- Click Repositories (under 'Repository Settings').
- Click Native repository access, and then Add repository.
- Complete the wizard:
Step 1
Field | Description |
---|---|
Repository Type | Select Git. |
Display Name | A name for this repository. The name may contain alphanumeric, underscore, '-' or '.' characters and its length must not exceed 100 characters. Note that a repository name is different from its key. See Renaming a repository for details. |
Description | Enter a short description of this repository. |
Step 2
Field | Description |
---|---|
Repository Location | Enter the URL describing the Git repository location. Fisheye will clone this repository for indexing purposes. You can use any URL recognized by Git itself. Fisheye recognizes the following URL's: git://server_name[:port]/path_to_repository http://server_name[:port]/path_to_repository https://server_name[:port]/path_to_repository ssh://server_name[:port]/path_to_repository file://[hostname]/path_to_repository Do not use spaces in your URL. |
Path | (optional) Enter the path within the Git repository that you want Fisheye to index. This lets you limit Fisheye to indexing a subset of the complete Git repository. |
Authentication Style | Choose the desired authentication style for your repository — No authentication, Generate key pair for SSH, Upload private key for SSH or Password for http(s). Please refer to Authentication for more information. |
Block Size | (optional) Enter how many commits you want Fisheye to process in one batch. Larger values require more memory and increase the amount of work Fisheye commits to the database in a single operation. The default is 400. The minimum being 1. This field only accepts positive whole numbers. Requires a repository restart. |
Command Timeout | (optional) Enter the time that a single Git command is allowed to take to execute. Any command that exceeds this time is terminated and the operation will fail. |
Rename Detection | (optional) Select which Git rename detection strategy Fisheye will use to detect copy and move operations within the repository. Please refer to the Git documentation for more information. |
Step 3
Field | Description |
---|---|
Store Diff Info | Check this if you want Fisheye to cache information about file diffs in its database. This is required for some Fisheye features. See Configuring Repository Details for more information on this setting. |
Enable Repository After Adding | Check this to enable the repository after adding (i.e. when you click the Add button). |
Limitations
Indexing of a Git repository can be slow when new branches are pushed. Performance in such cases can be improved by setting a command line option for Fisheye. See this KB page for more information.
Fisheye uses GIT_SSH variable to call fe-ssh.sh / fe-ssh.bat wrapper and to pass SSH key for the git process. Make sure that you don't have the GIT_SSH_COMMAND variable defined, which takes precedence over GIT_SSH.