Most likely the cause of this error is that the project file is not placed to the var/www/html where the apache has access to. But in this article, if you are having this error, you can push your project files by following the steps below.
1. Go to your project directory and delete the existing .git file and repeat git initiation
$ sudo rm -R .git $ git init
2. Open your repository then copy and paste the HTTPS url.
$ git remote add origin <https_url>
3. The git add and commit with sudo command.
$ sudo git add . $ sudo git commit -m "Initial Commit"
It will show the following where you will input your github user email and name.
4. Type the following with sudo and replace the email and username.
$ sudo git config --global user.email "email_used_in_github_account" $ sudo git config --global user.name "user_name_used_in_github"
5. Then commit again.
$ sudo git commit -m "Initial Commit"
6. Last step git push to push successfully the project files by typing your username and using personal generated token as its password.
$ sudo git push -u origin master
If its result is something similar to the image above, then you only have to wait for it to finish for it to be seen in your github repository.