First, git
/GitHub are largely black boxes to me--I only know how to do very simple things, so it's likely the answer to this is simple.
I was playing around today and realized I had a file in my repository that I didn't want publicly available, so I did all I could to delete it through the GitHub site (with ultimate success). I also deleted the .gitignore
and .Rprofile
files, the former because I'm not ignoring anything and the latter because I only added that by mistake.
Something here seems to have confused git
, as now I'm presented at various stages of debugging with any of the following errors:
git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
nothing added to commit but untracked files present (use "git add" to track)
Figuring git
might require a .gitignore
file even if it's empty, I restored the file to my directory to no avail:
git add .gitignore
git commit -m 'adding gitignore'
git push origin master
Gives me error:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/MichaelChirico/real_estate.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.
Then I tried again, trying to get the status
before pushing this time:
git add .gitignore
git commit -m 'adding gitignore'
git status
Tells me this:
On branch master
nothing to commit, working directory clean
Basically I'm lost as to what's going on. I've searched around for a while but couldn't find anything helpful (mainly comments about looking for discrepancies in the .gitignore
file) so I'm giving up and posting here.
I saw this post, but couldn't understand the answer.
Update: @Makoto requested the output of git branch -vv
:
* master 1a5db95 fixing .gitignore