SOLVED Remove git repo without deleting the contents inside the repo path

luissquall

Member
Jun 27, 2014
10
2
3
México
cPanel Access Level
Root Administrator
Hi,

By mistake I created a repo using "Git™ Version Control" ui on a path I would like to keep even if it is not associated with a repo. I created a new repo to test what happens when you delete a repo and unfortunately everything inside the repo was deleted.

Is there any way to remove the repo from "Git™ Version Control" list without deleting the files inside? I tried deleting only the .git folder but repo didn't disappear from the list. Where does cPanel/WHM keep track of this info? (Making a backup of the folder to delete the repo is my last option, I have around 100GB in the folder and the website is busy)

I think is dangerous not having an option / checkbox to keep the contents.

Thank you!
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,218
463
Hello @luissquall,

When you delete a repository, the system permanently deletes the entire contents of the repository's directory. You cannot recover this data after deletion. If you'd like to preserve the data, you must use SSH, FTP, or File Manager to copy or move the files and directories that you want to preserve to another location.

We do restrict the creation of Git repositories on cPanel-controlled directories:

  • Users cannot include whitespace or the following characters in repository paths:
    \ * | " ' < > & @ ` $ { } [ ] ( ) ; ? : = % #
  • Users cannot use this feature to create, delete, or view repositories in the following cPanel-controlled directories:

    Click to view...
    • .cpanel
    • .cphorde
    • .htpasswds
    • .ssh
    • .trash
    • access-logs
    • cgi-bin
    • etc
    • logs
    • perl5
    • mail
    • spamassassin
    • ssl
    • tmp
    • var
Note:

cPanel users cannot use the . or .. directory references when they enter the repository path in the interface.
However, this is not extended to user-created directories. I encourage you to open a feature request if you'd like to see an option to preserve the contents of the directory, and remove just the Git repo itself:

Submit A Feature Request

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,218
463
Hello @luissquall,

cPanel & WHM version 76.0.4 was published today and includes the following change:

Fixed case CPANEL-21276: Git version control no longer removes files from repository.

Here's an updated description of what happens when you remove a repo via cPanel >> Git Version Control in cPanel & WHM version 76.0.4 and later:

When you remove cPanel's management of a repository, the repository will no longer appear in the interface, and you cannot use cPanel to deploy it. However, the system will not delete the repository directory or its data. To fully delete repository data, use cPanel's File Manager interface (cPanel >> Home >> Files >> File Manager) or your preferred method to manually delete the files.
Thank you.
 
  • Like
Reactions: APatchworkBoy