Updated on 2023-07-25 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 there is no project under the account or you click Create Project in the Project drop-down list, the Create Project dialog box is displayed and you can create a basic project. (For a basic project, only CodeArts Repo and some services can be used. Other services are not enabled by default. You can change a project to a basic project on the project settings page.)
    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 2,000 characters.

    Programming Language of .gitignore

    No

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

    Permissions

    No

    The options are as follows:

    • Allow project members to access the repository

      The project manager is automatically set as the repository administrator, and the developer is set as a common repository member. When the two roles are added to the project, they will be automatically synchronized to existing repositories.

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

    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