Updated on 2024-07-05 GMT+08:00

Creating a Common Repository

You can create an empty repository and synchronize a local repository to CodeArts Repo. To create an empty repository on the CodeArts Repo console, perform the following steps:

  1. Log in to the Console, click in the upper left corner of the page, search for CodeArts Repo, click , the repository list page is displayed.
  2. Click New repository. The Project and Repository Type page is displayed. Select an existing project or click Create Project from the Project drop-down list box.

    • The code repository must be in a project. You can view the repository dashboard by project.
    • If the account does not have a project, click Create Project in the drop-down list box to create a Scrum or an IPD-Self-Operated Software/Cloud Service project.

  3. Set Repository Type to Common.
  4. Click Next. On the Basic Information page that is displayed, enter basic repository information.

    Table 1 Parameters for creating a common repository

    Parameter

    Mandatory

    Remarks

    Repository Name

    Yes

    Start with a letter, digit, or underscore (_), and use letters, digits, hyphens (-), underscores (_), and periods (.). Do not end with .git, .atom, or periods (.). Min. 2 characters. Max. 255 characters.

    Description

    No

    Enter a description for your repository. The description can contain a maximum of 2000 characters.

    Programming Language of .gitignore

    No

    The .gitignore file is generated based on your selection. (For details about gitignore, see What is gitignore?)

    Initial Settings

    No

    The options are as follows:

    • Allow generation of a README file

      You can edit the README file to record information such as the project architecture and compilation purpose, which is similar to a comment on the entire repository.

    NOTE:
    • The function of Make all project developers automatic repository members is unavailable. Project managers and developers will no longer be automatically added to repository members. By default, only project creator and administrator will be added to repository members.

    Visibility

    Yes

    The options are as follows:

    • Private: Only repository members can access and commit code.
    • Public: Read-only for visitors and hidden from repository lists and search results.

    Open-Source License

    No

    For public repository, you can select an existing license from the drop-down list box.

  5. Click OK to create the repository. The repository list page is displayed.

Associating with an Existing Directory or Repository

If you do not generate a README file when creating a common repository, you can click the Code tab, click Create a README file or associate the repository with an existing directory or repository. The procedure is as follows:

Prerequisites

  • You need to run following commands on the Git client. Install the Git client and configure the Git global username and user email address. For details, see Git Installation and Configuration.
  • Set the SSH key. For details, see SSH Keys.

Procedure

The following commands have been automatically generated in the new repository. You can copy them on the Code tab page of the repository.

  1. Clone the repository on the local host and push the new README file.

    git clone HTTPS_download_address
    cd taskecho "# Repository_name" > README.md
    git add README.md
    git commit -m "add README"
    git push -u origin master

  2. Associate an existing code directory with the repository.

    cd <Your directory path>
    mv README.md README-backup.md
    git init
    git remote add origin  HTTPS_download_address
    git pull origin master
    git add --all
    git commit -m "Initial commit"
    git push -u origin master

  3. Associate with an existing Git repository.

    cd <Your Git repository path>
    git remote remove origin > /dev/null 2>&1
    git remote add origin  HTTPS_download_address
    git push -u origin --all -f
    git push -u origin --tags -f