How do i use git inside the xampp's htdocs folder on linux

I’ve been trying to work with git on my php web project that i already had, just changed the file type to php to connect it to a database, and since is no longer html i needed a web server so i use xampp. The thing is that from the very beggining it doesn’t let me clone the repo unless i do it as sudo, and when i do clone it with sudo git clone https:github/myprofile/repo.git it doesn’t let me do things such as pulls, commits or pushes. Any idea on how to solve this or another way to execute my project on a local web server while being able to use git would be really apreciated. If it helps i’m on arch linux(i use arch btw) and the latest version available of xampp.

Already tried changing the project’s directory owner with sudo chown myuser project/* and then doing sudo chown myuser .git/* expecting this would be enough but still gives me errors regarding permissions.