ga-wdi-exercises / project1

[project] GA- Project 1
3 stars 75 forks source link

Issue with Github #180

Closed mcgrodsky closed 9 years ago

mcgrodsky commented 9 years ago

Trying to commit changes - here is what happened:

$ miakodaMiaKodas-MacBook-Air: Tue Oct 27: ga index.html script.js css/
~/wdi/projects/new project 1 (master +)
$ miakodaMiaKodas-MacBook-Air: Tue Oct 27: gc -m "function to count number of clicks working"
[master 76bd7de] function to count number of clicks working
 3 files changed, 31 insertions(+), 15 deletions(-)
~/wdi/projects/new project 1 (master)
$ miakodaMiaKodas-MacBook-Air: Tue Oct 27: git push origin master
To git@github.com:mcgrodsky/Project1---Memory-Matching-Game.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:mcgrodsky/Project1---Memory-Matching-Game.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.
~/wdi/projects/new project 1 (master)
RobertAKARobin commented 9 years ago

It tells you what to do right in the error message:

hint: (e.g., 'git pull ...') before pushing again.
mcgrodsky commented 9 years ago

I did "git pull" and it corrected the issue. Do you know why/how this would happen though? Aka how Git had files that i didn't have locally?

RobertAKARobin commented 9 years ago

My guess is that you were working on two different branches, pushed one branch to Github, and then switched over to the other branch, which hadn't been pushed to Github. Thus, Github was "ahead" of that other branch.

adambray commented 9 years ago

Another possibilitiy:

you created / edited a file using the github.com web interface (which makes a commit on the github copy of the repo)

adambray commented 9 years ago

looking at your commit history, it might have been creating the README.md

mcgrodsky commented 9 years ago

ah! Adam I think that's it - i did create README.md in git after initializing the repository and pushing up my work. But it seems to be working fine now. Thanks guys!