This topic helps you get started with Apsara DevOps Codeup.
Prerequisites
Install Git on your local machine to use the command line. For more information, see Install Git.
To clone and commit code using the Secure Shell (SSH) protocol, configure an SSH public key for your platform account. For more information, see Configure an SSH key.
Background information
You can access Apsara DevOps Codeup from the following entry points:
Step 1: Create your first repository
Log in to Apsara DevOps Codeup and click New Repository in the upper-right corner of the home page.
In the dialog box that appears, configure the following parameters:
Repository Name: The name of the repository. The name can contain letters, digits, underscores (_), periods (.), and hyphens (-). It must start with a letter, digit, or underscore (_).
Specify the code repository path.
Visibility: The visibility of the repository. An organization-public repository is visible to all members of the organization, except for external members. A private repository is visible only to its members. For more information, see Platform permission settings.
Description: A brief description of the repository.
Configure advanced initialization options, such as readme, .gitignore, and storage encryption.
Click OK to create your first repository.
NoteIf you use another code hosting platform, you can use the code import feature of Apsara DevOps to quickly import code. For more information, see Migrate or import a third-party repository.
Step 2: Commit your first line of code
Apsara DevOps Codeup supports two methods for committing code: committing code on the web or from a local Git client.
Commit code on the web
Navigate to the repository that you created.
Select a file, such as README.md, and click the Edit button in the upper-right corner.
Modify the content and click Save. For example, you can add content to the end of the README.md file.
// Explain the purpose of the readme document >The readme document contains the description of the code repositoryIn the dialog box that appears, enter a commit message.
Enter a title and a detailed description for the commit to explain the reason for the change. If you leave this field blank, a default commit message is used.
NoteThe title of the commit message must be in English, must not exceed 50 bytes in length, and must not end with a period (.).
Click Commit Now to commit the file changes to the specified branch, such as the master branch.
Verify the result. In the navigation pane on the left of the repository, click Commits to check whether your changes are committed to the repository.
Commit code from a local Git client
You must install Git to use it locally. For more information, see Install Git.
Clone the code to your local machine
Navigate to the repository that you created.
In the upper-right corner of the repository's home page, click Clone/Download to obtain the clone URL.
You can clone the repository using SSH or HTTPS. The clone URL varies based on the protocol that you select.
Clone the repository.
To clone the repository using the HTTPS protocol:
NoteBefore you clone a repository for the first time, you must configure a username and password for cloning. For more information, see Configure an HTTPS password.
On the repository page, select HTTPS and copy the URL.
In Git Bash, run the clone command.
git clone https://codeup.aliyun.com/your-company/xxx.git # Replace with the repository URL you copiedWhen prompted by the terminal, enter the username and password that you configured.
To clone the repository using the SSH protocol:
NoteBefore you clone a repository for the first time, you must configure an SSH public key. For more information, see Configure an SSH key.
On the repository page, select SSH and copy the URL.
In Git Bash, run the clone command.
git clone gi*@codeup.aliyun.com:your-company/xxx.git # Replace with the repository URL you copiedThe terminal automatically finds the available public and private key files, establishes an SSH connection with the remote server, and clones the repository.
Modify and push code locally
Add your local file changes, such as modifications, additions, or deletions, to the Git index. For example, you can create a file named hello.java in your local repository and run the
git addcommand to instruct Git to track the version changes of this file.git add hello.javaCreate a new commit.
Run the
git commitcommand to commit the changes that are recorded in the index to the repository.git commit -m "add hello.java" # Write the commit message in the double quotation marksPush the changes from your local repository to the remote repository.
For example, to push the changes to the remote master branch, run the following command:
git pushVerify the result.
Go to the destination repository and refresh the page. You can view the push record and the changes that are synchronized from your local machine, including the newly added hello.java file.
Step 3: Invite members to collaborate
The repository administrator is responsible for inviting members.
In the navigation pane on the left of the destination repository, click Members to view member information.
Code repository administrators can add members.
You can search for all members of the current organization by username. Members who have already joined the repository are selected by default.
If a user has not joined the organization, you must invite the user to become an organization member before you can add the user to the repository. For more information, see Organizations.
Select the members that you want to add and assign roles to them.
You can add members by department and enable automatic synchronization of personnel changes. This way, you do not need to manually modify member permissions in the repository when members are added to or removed from a department.
Step 4: Enable code scanning
Codeup provides a built-in code scanning service to help you manage your code assets during development. Click New Scan Task. In the New Scan Task dialog box, select a scanning scheme. For more information, see Use the code scanning service. For the trigger method, you can select either Commit Trigger or Merge Request Trigger. After the configuration is complete, scans are automatically triggered and the results are returned promptly.
Step 5: Use code review
Apsara DevOps Codeup provides a collaborative code review service. After you finish developing a feature, you can create a merge request. The specified owners can then review your code through an approval process to continuously monitor code quality.
Configure rules for Branch Settings and Merge Request Settings. For more information, see Branch settings and Merge request settings.
Create a merge request to initiate a code review.
After the merge conditions are met, merge the code.