I have created a repo within cPanel, cloned it to my local computer and then added some files. Now when i push the commits back up, everything seems to work nicely. However, the cPanel filemanager shows no files in the corresponding repo except for the .git-Folder.
This is what I do in git bash:
This is what the cPanel filemanager shows me… nothing:
Any clues?
2
Answers
Git would checkout files with content.
You have created three empty files (
touch a.txt
)Try again, with a minimal content
Another explanation: the remote repository is a bare one (its
.git/config
file includesbare = true
)Or, following
git config receive.denyCurrentBranch
on the server (cPanel) side: since it is set to ignore… it will allow the push but will not update the working tree.This will solve your problem for sure as i wasted my 5 hour in search for the same issue –
–version In my case it was 2.19.1 which is this root cause for this problem.
Now make sure on remote config denyCurrentBranch = updateInstead below is my remote config screenshot, you can check remote config using command git config –edit when you inside remote repo directory
My Live git config screenshot
Now clone the cpanel repo on your local, and check your local git config file and make sure it has the tag [remote “origin”] [Screenshot 2 ]if you can’t find it use this command on your local
git remote add origin ssh://username@website/home/username/reponame
git push origin master -u –exec=/usr/local/cpanel/3rdparty/bin/git-receive-pack
Best Of Luck 🙂