0

I am following Michael Hartl's tutorial (chapter 3 section 3.1 https://www.railstutorial.org/book/static_pages) using cloud 9 IDE and trying to push the sample_app to bitbucket. When I type the following command into cloud 9 IDE:

Since we’ll be using this sample app throughout the rest of the book, it’s a good idea to create a new repository at Bitbucket and push it up:

$ git remote add origin git@bitbucket.org:/sample_app.git $ git push -u origin --all # pushes up the repo and its refs for the first time

I get the following error

fatal: remote origin already exists. 

(NOTE: I have changed username to my username).

Since I got the error I have tried several solutions including deleting everything from bitbucket fromt he previous exercises in the book. so far i have followed the instructions to the letter, although I did accidentally close some of the tabs in the command line on cloud 9 and I don't know if this made any difference. I also notice that nothing seems to have been created on git even though i did git init, git add -A and git commit. What have I missed. help is greatly appreciated so I can move on. Please let me know if there are any files I should add to an edit of this post. Thanks.

Owen
  • 361
  • 1
  • 5
  • 16
  • Possible duplicate of [Remote origin already exists on 'git push' to a new repository](https://stackoverflow.com/questions/1221840/remote-origin-already-exists-on-git-push-to-a-new-repository) – phd Oct 08 '17 at 13:29

1 Answers1

0

fatal: remote origin already exists.

The remote you're trying to add already exists. Run git remote -v and check in the ouput it gives to you, if is there, then skip the first command and pass the second one to push.

Sebastián Palma
  • 32,692
  • 6
  • 40
  • 59
  • result of git remote -v as follows: heroku https://git.heroku.com/still-beyond-10331.git (fetch) heroku https://git.heroku.com/still-beyond-10331.git (push) origin git@bitbucket.org:owen358/sample_app.git (fetch) origin git@bitbucket.org:owen358/sample_app.git (push) – Owen Oct 08 '17 at 12:28
  • 1
    There's, your `origin` is `git@bitbucket.org:owen358/sample_app.git`, is it the same you're trying to add? if so, just use `git push`. – Sebastián Palma Oct 08 '17 at 12:29