I struggled with this error for more than an hour! Below is what helped me resolve it. All this while my working directory was the repo i had cloned on my system.
If you are doing adding files to your existing repository**
1. I pulled everything which I had added to my repository to my GitHub folder:
git pull
Output was-
some readme file
file1
file2
- I copied (drag and drop) my new files (the files which I wanted to push) to my cloned repository (GitHub repo). When you will ls this repo you should see your old and new files.
eg. some readme file
file1
file2
newfile1
newfile2
git add "newfile1" "newfile2"
[optional] git status
this will assure you if the files you want to add are staged properly or not
output was
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD ..." to unstage)
new file: newfile1
new file: newfile2
5.git commit -m "whatever description you want to give"
6.git push
And all my new files along with the older ones were seen in my repo.