Linking a Git repository to a project means connecting your local project files to a
remote Git repository such as GitHub, GitLab, or Bitbucket so you can track changes, collaborate
with others, and back up your code.
Before you begin
Make sure that the repository you are going to use meets the requirements, which are listed
in the Configuring Git accounts section.
About this task
The Git account of the user who creates a project is used for pulling the project details from
the Git repository. However, committing and pulling changes in the UI is restricted to the Git
account of the logged in user. If the user did not add a Git account already, then a prompt is
displayed to enter their Git username and access token. If you do not select any source control
account, then the project uses the IBM hosted repository.
Procedure
-
On the Projects page, click +.
The New Project dialog is displayed.
- Enter a name for the project that you want to create in Project
Name.
The name must match the name of the Git repository you are going
to use (before the Project suffix).
- In Source Control - Git server/account, select the source control
name of the Git account that has access to the repository. The drop-down menu displays all Git
accounts that you own as well as shared accounts.
If you want to use a new Git account, click Add. For more information, see
Configuring Git accounts.
Note:
- The Repository field lists the Git repository URL and hostname details
based on your selection in the Source Control - Git server/account field. You
can click Copy to copy the Git repository name. The repository name is the
same as the project name suffixed by the word Project. For example, if the
project name is Demo, the repository name must be DemoProject.
- If you do not select any Git account, then the project files are stored to a Git repository,
managed by IBM®.
- Update the repository path if needed in the Repo path
field.
- Click Open to verify the connection to the Git
repository.
- Enter a name of the branch in the Branch field. The default branch
is Main.
- Click Create.
Results
The project is created and linked to the specified Git repository. From now on, your project
files are stored in the Git repository.Also, an icon
is displayed on the project card to indicate that the project is linked to
an external Git repository.
Note: Deleting a project does not remove the project assets that are
stored in external Git repositories.