Code repository usage issues
Answers common questions about code repositories in Apsara DevOps, including committer vs. author differences, code rollbacks, repository address simplification, Go dependency management, TortoiseGit errors, Jenkins integration, Flow pipelines, ACR usage, regular expressions, batch downloads, merge file exclusion, and repository import and migration.
Difference between a committer and an author
In Git, every commit has an author and a committer, which can be two different people. For more information, see What is the difference between a committer and an author?
Author: The person who originally created the changes.
Committer: The person who submitted the changes to the repository. In an email-based workflow, this is often the project maintainer.
Configuration method:
git config --global user.name "Your Name"
git config --global user.email your.name@example.comValidating and modifying:
Use
git log --pretty=fullerto view detailed commit information.Modify the committer's email for the latest commit:
git commit --amend.To modify the email of the author or committer, run the following command:
git commit --reset-author --amend.Change information in historical commits: Use the
git rebase -icommand for an interactive rebase.
Roll back code
If an unexpected merge or commit introduces errors, use the revert or reset command to restore a previous version. For more information, see How do I roll back code?
revertcommand: Reverses the changes from a specific commit but keeps the commit history.resetcommand: Rolls back to a specific commit and erases all commit history after that point. You must force push the changes to the remote repository.
If a remote branch was accidentally rolled back to an older version, you can find the correct commit ID and create a new branch to overwrite the remote branch. If a remote branch contains unintended content from an earlier merge, you can find the commit that you want to restore.
Simplify repository addresses
Background: Organization IDs in Apsara DevOps can make URLs hard to remember. Set a custom organization name to simplify repository addresses.
Procedure:
Go to .
Set a custom organization name to replace the default organization ID.
Note: The organization name can be set only once. Choose it carefully.
For more information about the procedure, see What do I do if my repository address has a long, random ID?
Go dependency management
Background: To ensure the security of your organization's data, you must handle authentication when managing Go dependencies.
.netrc file: Stores authentication information, such as usernames and passwords, for automatic logon.
Best practice: Configure an HTTPS clone username and password for Codeup. Store them in the
.netrcfile for security and convenience. For more information, see How do I use Go dependency management?
Troubleshoot TortoiseGit tool errors
Common issue: Push or pull failures in TortoiseGit are often caused by incorrect Secure Shell (SSH) key configuration.
Solution:
Change the SSH client to OpenSSH instead of TortoiseGitPlink.
Confirm that the public key is added to Pageant in your local PuTTY installation.
For more information about the operations, see How do I handle errors related to the TortoiseGit tool?
Associate requirements, tasks, or bugs with a commit
Associate requirements, tasks, or bugs with commits to improve traceability. For more information, see Associate R&D assets.
Integrate with Jenkins for continuous integration
Overview: Integrate your Codeup repository with Jenkins to automate build, test, and deployment processes. For more information, see How do I integrate with Jenkins for continuous integration?
Associate a Flow pipeline in Codeup
Overview: Associate your Codeup repository with a Flow pipeline to automate build, test, and deployment processes.
Create a pipeline:
Method 1: Go to the target repository, click the Pipelines tab, and then click New Pipeline.
Method 2: From the menu in the upper-left corner, select Pipelines, and then click New Pipeline. For the code source, select Codeup.
Select a code source: On the creation page, select Codeup as the code source and enter the required configuration.
Automatic triggering event: To automatically run the pipeline for every commit, select the Automatically trigger on code commit checkbox.
Complete the association: After the pipeline is triggered for the first time, the relevant information is synchronized to the specified repository in Codeup. This completes the association.
Rich detection services: Flow pipelines also support static code analysis, security scans, and other checks.
For more information about the operations, see How do I associate a Flow pipeline?.
Use Alibaba Cloud Container Registry (ACR)
Background: Codeup integrates with Alibaba Cloud Container Registry (ACR) to support containerized application development.
Procedure:
Create a new image repository in the ACR console.
In the Flow pipeline configuration, select Codeup as the code source.
Authorize the Flow pipeline to use ACR tasks and select the corresponding image repository.
ACR provides container image hosting, and you can combine it with Apsara DevOps pipelines to automate build and release processes. For more information, see How do I use Alibaba Cloud Container Registry (ACR)?
Regular expressions
Syntax support: Codeup supports only RE2 syntax, which differs slightly from PCRE. Matching is case-sensitive by default.
For more information about the syntax and specific usage, see How to write regular expressions.
Associate an existing folder or repository
Associate a local folder: To quickly associate an existing local project folder and push it to the cloud, run the following commands:
cd existing_folder
git init
git remote add origin https://codeup.aliyun.com/xxx/xxx.git
git add .
git commit -m "Initial commit"
git push -u origin masterImport a third-party repository: There are two ways to import a repository hosted on another platform:
Use the command line to clone the remote repository with
git clone --bare. Then, set the new remote URL and push all branches and tags withgit push --mirror.Use the Import Repository feature on the Codeup web UI to import directly from an external repository URL.
For more information, see How do I associate an existing folder or repository?
Download multiple repositories in batches
Solution: The git-repo service supports batch downloads for managing multiple related Git repositories. For more information, see AGit-Flow Alibaba's centralized Git workflow.
Ignore files during a merge
Local merge strategy: Server-side merge requests do not directly support ignoring specific files. However, you can achieve this during a local merge by configuring the .gitattributes file. For example, to prevent a file from being updated during a merge, add the following to the .gitattributes file in the file's directory:
# Prevents the file demo.txt in the root directory of the dev branch from being merged into the master branch
demo.txt merge=ours
# Prevents the file /common/src/main/resources/demo.yml in the dev branch from being merged into the master branch.
/common/src/main/resources/demo.yml merge=oursThen, before you merge, run the command git config merge.ours.driver true to enable this strategy. Finally, perform the merge as usual. For more information, see How do I ignore files during a merge?
Repository import and migration FAQ
Network connectivity issues: If an import from a self-hosted GitLab instance fails with a "cannot connect" error, use one of the following solutions:
Recommended solution: Use the official Apsara DevOps import tool for on-premises repositories. This does not require public network access.
Alternative solution: Adjust your GitLab configuration to expose a public clone address so that Apsara DevOps can pull the code.
Cross-organization migration: To migrate a repository between Apsara DevOps organizations, import it by URL. On the repository homepage of the target organization, click Import Repository, select Import by URL, and enter the source repository's HTTPS address and authentication information.
For more information about the operations, see Repository import and migration FAQ.