GitLab is a very popular source code management tool. It provides a series of functions, such as version control, collaborative development, code review, etc., making team code development more efficient, safe and reliable. However, for projects on GitLab, we need to delete them if they are no longer needed. This article will introduce how to delete projects on GitLab server.
First, we need to log in to the GitLab server. For security reasons, we recommend using the SSH protocol to log in. The SSH protocol connects to the remote server through public key encryption, which can effectively protect the security of the connection.
Login command:
ssh username@gitlab.example.com
Among them, username is your user name on the GitLab server, and gitlab.example.com is the address of the GitLab server.
After logging in, we need to find the items that need to be deleted. We can find the project ID or project name through GitLab's web interface so that we can delete it on the command line.
Next, we can use the command line tool provided by GitLab to perform the deletion operation. Type the following command at the command line:
Delete by project ID:
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/<project_id>
where
Delete according to the project name:
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/<namespace>%2F<project_name>
Where,
The private token in the above command can be generated in GitLab's user settings page. Note that using these commands may require administrator privileges.
After the deletion command is executed, an HTTP status code will be returned. If the status code is 200, the deletion is successful. At the same time, in the GitLab web interface, the project should also have been deleted.
It should be noted that this operation is irreversible, and the data cannot be recovered after deletion, so please operate with caution.
In general, deleting a project on the GitLab server is a very simple operation and can be easily completed by just entering a few commands through the command line. But before deleting, please be sure to confirm the items you want to delete and back up your data.
The above is the detailed content of How to delete a project on GitLab server. For more information, please follow other related articles on the PHP Chinese website!