Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push >> fatal: no configured push destination

I'm still going through some guides on RoR and I'm stuck here at Deploying The Demo App

I followed instructions:

With the completion of the Microposts resource, now is a good time to push the repository up to GitHub:

$ git add . $ git commit -a -m "Done with the demo app" $ git push 

What happened wrong here was the push part.. it outputted this:

$ git push fatal: No configured push destination. Either specify the URL from the command-line or configure a remote repository using git remote add <name> <url> git push <name> 

So I tried following the instructions by doing this command:

$ git remote add demo_app 'www.github.com/levelone/demo_app' fatal: remote demo_app already exists. 

So I push:

$ git push demo_app fatal: 'www.github.com/levelone/demo_app' does not appear to be a git repository fatal: The remote end hung up unexpectedly 

What can I do here? Any help would be much appreciated.

like image 624
levelone Avatar asked Apr 05 '12 17:04

levelone


People also ask

How do I set a push destination in git?

Run the git remote set-url --add --push origin git-repository-name command where git-repository-name is the URL and name of the Git repository where you want to host your code. This changes the push destination of origin to that Git repository.

How do I resolve a fatal error in git?

A Git command needs to be run on a specific repository, so this error typically occurs when a Git command is run in a directory that Git doesn't know about. In these cases, the fix is to make sure that you are both working in the correct folder and that you set up your repository right.


1 Answers

You are referring to the section "2.3.5 Deploying the demo app" of this "Ruby on Rails Tutorial ":

In section 2.3.1 Planning the application, note that they did:

$ git remote add origin [email protected]:<username>/demo_app.git $ git push -u origin master 

That is why a simple git push worked (using here an ssh address).
Did you follow that step and made that first push?

 www.github.com/levelone/demo_app 

That would not be a writable URI for pushing to a GitHub repo.

https://[email protected]/levelone/demo_app.git 

This should be more appropriate.
Check what git remote -v returns, and if you need to replace the remote address, as described in GitHub help page, use git remote --set-url.

git remote set-url origin https://[email protected]/levelone/demo_app.git # or  git remote set-url origin [email protected]:levelone/demo_app.git 
like image 187
VonC Avatar answered Sep 17 '22 20:09

VonC