This document describes how to lock files and folders in a code repository.
Open Project
1. Log in to the CODING Console and click the team domain name to go to CODING.
2. Click in the upper-right corner to open the project list page and click a project icon to open the corresponding project. CODING allows you to lock files or paths of the Default Branch (usually the master branch) in code repositories. Only the user who locked the file can modify (edit or delete) it. If a user locks a path, all files in the path will be locked and can only be modified by the user who locked it.
Permission Description
Project admins can enter the project, click Project Settings in the lower-left corner, and go to Projects and Members > User Groups to set permissions for the repository. After setting the permissions, add team members to the relevant user groups to control the permissions to code repositories in the project.
A project member with permission to Access Code Repositories can lock files or paths on the Browse page. Locked files or paths can be unlocked on the Browse page.
A user can only unlock files or paths they locked; a member with permission to Unlock Locked Files can unlock files or paths locked by another user.
Lock a File
Go to the Browse page of a project repository and select a file. Click the More Actions button in the upper-right corner and select Lock.
A padlock icon will appear after the file is locked. Only the member who locked this file can edit or delete it.
Lock a Folder
Select a folder in a repository, click the More Actions button in the upper-right corner, and then select Lock to lock all files in the path.
Lock Result
A locked file can only be edited/deleted by the user who locked the file. Only the user who locked the path can create/edit/delete files in it. If another user tries to modify the locked file by pushing, the push will fail.
In a merge request, if the target branch is the default branch and the directory to be written includes a locked file or path, the merge can only be performed by the user who locked the file or path. Other members cannot merge the branches.
Unlock a Locked File or Folder
A project member can unlock files or folders they locked on the Browse page; a member with permission to Unlock Locked Files can unlock files or folders locked by another user.
Project admins can view locked files/folders in Settings > File Locking. Click Delete to unlock the file or folder.
Was this page helpful?