I recently pushed my first repository in the GitHub account from Linux Mint Terminal. It was quite straightforward. I can see my repository with all my files is there. I am also able to clone it successfully. All set.
Now I just want to update my README.md file or any other file and update this single file to GitHub account using the command line tool. Somehow, I am not able to do that. I dont want to login my github account and edit the file there, because this way my local and repository wont be same (unless I again pull it back to my local machine).
I tried this:
- Edited the file.
- git add .
- git commit -m "adding a README File to the repository"
- git push origin master
In the 4th step, I get the below error:
Username for 'https://github.com': xxx
Password for 'https://xxx@github.com':
To https://github.com/xxx/MyTest.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/xxx/MyTest.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
What am I doing wrong? There is any thing missing or the whole thing is wrong itself. I did not get a straight answer to this. Please suggest.