Updated on 2023-12-04 GMT+08:00

Creating an Empty 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. Access the repository list page.
  2. Click New Repository. On the page that is displayed, enter basic repository information.

    Table 1 Parameters for creating an empty repository

    Parameter

    Mandatory

    Remarks

    Repository Name

    Yes

    The name must start with a letter, digit, or underscore (_) and can contain periods (.) and hyphens (-), but cannot end with .git, .atom, or period (.). The name can contain a maximum of 200 characters.

    Project

    Yes

    • A repository must be associated with a project.
    • If the account does not have a project, click Create Project in the drop-down list box to create a basic, a Scrum or an IPD-Self-Operated Software/Cloud Service project.
    NOTE:

    If you create a repository in a project, the project is selected for Project by default, and the Project parameter is hidden on the repository creation page.

    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 Documentation.)

    Permissions

    No

    The options are as follows:

    • Make all project developers automatic repository members

      If you select this option, the project developer is automatically added as a repository member. By default, the project manager is a repository member.

    • 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.

    • Create a code check task automatically (for free).

      After the repository is created, you can view the code check task of the repository in the CodeArts Check task list after switching to the region where the repository is located.

    Visibility

    Yes

    The options are as follows:

    • Private

      The repository is visible only to repository members. Repository members can access the repository or commit code.

    • Public read-only

      The repository is open and read-only to all guests, but is not displayed in their repository list or search results. You can select an open-source license as the remarks.

  3. 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 HTTP_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  HTTP_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  HTTP_download_address
    git push -u origin --all -f
    git push -u origin --tags -f