2

I know there are similar questions to this, but nothing that has been suggested is working for me, and I'm losing my mind with this!

Quick rundown: Completely new to programming. Started from scratch on learning Rails with a book.

I'm on a mac(osx 10.7.5),I've installed Ruby, Rails, and Git (and the needed command line tools), but git/github is definitely giving me problems.
I followed what was suggested here: Github "Updates were rejected because the remote contains work that you do not have"

So first I did:

git remote add origin https:/github.com/MY_USER/learn-rails.git

and I get:

fatal: remote origin already exists.

I then move on to:

git push -u origin master

and I keep getting the following error:

![rejected]master -> master (fetch first)
error: failed to push some refs to 'https://github.com/MY_USER_NAME/learn-rails.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.

I go ahead and try:

git pull origin master

which gives me this:

From https://github.com/MY_USER/learn-rails
* branch            master     -> FETCH_HEAD
Auto-merging config/initializers/secret_token.rb
CONFLICT (add/add): Merge conflict in config/initializers/secret_token.rb
Auto-merging config/environments/development.rb
CONFLICT (add/add): Merge conflict in config/environments/development.rb
Auto-merging Gemfile.lock
CONFLICT (add/add): Merge conflict in Gemfile.lock
Auto-merging Gemfile
CONFLICT (add/add): Merge conflict in Gemfile
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.        

Even more background info: This is my second go around with this test/learning project due to having completely different problems pushing to Github previously. I scratched the whole thing and started fresh from chapter one, hoping that I might of just missed something when I was setting up GIt. I was previously have a ver stubborn problem with Github telling me the repository doesn't exist. I tried so many things to try and fix that problem, that I lost track of what I had even tried. So I just wanted to start clean. I deleted the "Learn-Rails" directory on my computer, and recreated it for this go around. I deleted the previous repository from my Github account, and now have started a new one, but it was named the same exact thing before. Would that cause an issue?

Community
  • 1
  • 1
Anthony Myers
  • 393
  • 1
  • 6
  • 18

1 Answers1

1

Firstly, check what the origin is. Open .git/config from your app root. should have something like this in there:

[remote "origin"]
  url = git@github.com:tomdunning/gideons.git
  fetch = +refs/heads/*:refs/remotes/origin/*

The next issue you had was the pull brought in a merge conflict. Run git mergetool to start managing the merge for each issue until all are resolved.

TomDunning
  • 4,829
  • 1
  • 26
  • 33
  • Thank you for your reply! I do that in my file, along with this above it: [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = false – Anthony Myers Jan 25 '14 at 18:20
  • When I run mergetool, I'm told that it isn't configured, and then I get this: 'git mergetool' will now attempt to use one of the following tools: opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare emerge vimdiff Merging: .gitignore Gemfile Gemfile.lock config/environments/development.rb config/initializers/secret_token.rb – Anthony Myers Jan 25 '14 at 18:26
  • When I run mergetool help, I get:'git mergetool --tool-' may be set to one of the following: emerge opendiff vimdiff vimdiff2 The following tools are valid, but not currently available: araxis bc3 codecompare deltawalker diffmerge diffuse ecmerge gvimdiff gvimdiff2 kdiff3 meld p4merge tkdiff tortoisemerge xxdiff – Anthony Myers Jan 25 '14 at 18:27
  • Thank you. I did have to go ahead and install a mergetool. I picked Diffmerge, and then I found what the issues were. – Anthony Myers Jan 27 '14 at 04:52