Push restriction issues

更新时间:
复制 MD 格式

This topic describes the limitations and solutions for pushing code to the Apsara Devops platform. It covers file size limits, rate limiting thresholds, modifying commit history, and using the git-filter-repo tool to resolve issues that you might encounter when you push code.

Code repository file push size limits

Overview: To ensure system performance and stability, Apsara Devops has specific size limits for single file uploads that vary based on the push method.

  • Web upload limit: A single file cannot exceed 50 MB.

  • Command line upload limit: A single file cannot exceed 200 MB.

  • Recommendation for large files: To manage large binary files that exceed the limit, see Introduction to the Codeup Git LFS feature.

FAQ and solutions:

  • Error when pushing a single large file: If you receive the "object exceeds maximum allowed size" error, it means the file exceeds the allowed size. You can use Git LFS to manage large files.

  • Push fails due to large data volume: If an HTTPS push fails because the data volume is too large, switch to the Secure Shell (SSH) protocol.

  • Push and clone timeouts: The timeout for a push operation is 60 minutes. The timeout for a clone operation is 30 minutes. If a timeout occurs, check the repository size and network conditions.

For more information, see Are there size limits for pushing files to a code repository?

Rate limiting thresholds for code pushes

Background: To ensure fair service and resource allocation, the Apsara Devops platform sets rate limiting rules for pushes from user accounts and SSH keys.

  • User account limit: Each user can concurrently push to or pull from a maximum of 10 repositories.

  • SSH key limit: A single SSH key can be used to call API operations a maximum of 50 times per minute.

These limits help maintain system stability and encourage users to plan concurrent operations to avoid unnecessary conflicts or delays. For more information, see What are the rate limiting thresholds for code pushes?

Modify commit history

Scenario: During versioning, you may need to adjust existing commit records. For example, you may need to fix spelling errors, remove sensitive information, or optimize the commit log format. For more information, see How do I modify commit history?

User guide:

  • Modify the last commit comment: You can use the git commit --amend command to update the most recent commit message.

  • Modify multiple commit messages: You can use the interactive rebase feature (git rebase -i) to edit multiple historical records at once. Be careful when you modify changes that are already pushed to a remote repository to avoid confusion.

  • Modify commit author or email: You can change committer information for single or multiple commits using the rebase method with specific parameters. For large-scale history revisions, you can use a specialized tool such as git-filter-repo for efficient processing.

  • Set local pre-commit checks: To avoid frequent history modifications, you can use Git hooks (githooks). This lets you implement commit rule checks locally before you push and ensures that all pushed content meets your requirements.

Use git-filter-repo to modify commit history

Tool introduction: git-filter-repo is a powerful and officially recommended tool that you can use to efficiently and safely modify the commit history in a Git repository. Advanced operations include replacing committer emails and editing commit messages. For more information, see git-filter-repo.

Installation and configuration:

  • Prerequisites: Make sure your environment meets the minimum version requirements: Git 2.22.0 or later and Python 3.5 or later. Then, follow the official documentation to complete the installation.

  • Examples: The following command templates show how to use Python callback functions to make precise history modifications. For example, you can change the email suffix of some commits on a branch from alibaba-inc.com to example.com. You can also add a prefix to commit messages within a specified range.

    # Example: Modify email
    git-filter-repo --email-callback 'return email.replace(b"alibaba-inc.com", b"example.com")' --force --refs master~2..master
    
    # Example: Modify commit message. The message of the last commit is changed from "3" to "hi".
    git-filter-repo --message-callback 'return message.replace(b"3", b"hi")' --force --refs master~1..master
    
    # Example: Add a prefix. "bugfix: " is added before the message of the last commit.
    git-filter-repo --message-callback 'message=b"bugfix: " + message return message' --refs master~1..master --force

Note: Each modification generates a new commit ID. Before you run the modification command, create a backup branch to save the current state.

This topic helps you understand and manage various push restriction scenarios on the Apsara Devops platform. If you have other questions or need more help, contact us.