levelone
levelone

Reputation: 2389

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.

Upvotes: 75

Views: 294923

Answers (10)

Ritansh Rajput
Ritansh Rajput

Reputation: 1

This problem occurs simply because we have not set whether this repository should be private or public to resolve this :

  • git add .

  • git commit -m "your message"

  • git push

  • (go to git-branch icon on vscode side panel > click on publish branch blue botton > drop down will be open on top > select private of public )

And done.

Upvotes: 0

Hagit
Hagit

Reputation: 11

Through VS-Code:

  1. git add .
  2. git commit -m "some comments"
  3. git remote add origin [email protected]:yourusername/yourrepository.git
  4. git push --set-upstream origin master

Upvotes: 1

Sanidhya Vijaivargia
Sanidhya Vijaivargia

Reputation: 159

If you are using git commands using cmd

git remote add origin [email protected]:<username>/demo_app.git

You can copy it from your repo https code you are currently working on.

After this run

git push

This worked for me.

Upvotes: 3

acoul
acoul

Reputation: 1

Here is how I resolve the same issue:

  1. create repository

  2. git branch -M main

  3. git push -u origin main

Upvotes: 0

VonC
VonC

Reputation: 1323403

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

Upvotes: 61

Mista Aries
Mista Aries

Reputation: 1

I had the same problem

using vs code if you click on the menu button go down to push,pull then scroll down to push to and

Upvotes: 0

Mert Sevinc
Mert Sevinc

Reputation: 1027

This happened to me when I was using Visual Studio Code with Github. I have realized that the upstream branch was empty for some reason and push did not know where to push. Using "sync" fixed the problem.

Upvotes: 0

Kasun Asela
Kasun Asela

Reputation: 53

I already have faced this error. I create a github repository and I copy repository Url and I run following command.

git remote add service-center-app 'https://github.com/DeveloperAsela/service-centerapp.git'

Upvotes: 0

Syed Tabish Ali
Syed Tabish Ali

Reputation: 313

I have faced this error, Previous I had push in root directory, and now I have push another directory, so I could be remove this error and run below commands.

git add .
git commit -m "some comments"
git push --set-upstream origin master

Upvotes: 6

Joachim Isaksson
Joachim Isaksson

Reputation: 180887

The command (or the URL in it) to add the github repository as a remote isn't quite correct. If I understand your repository name correctly, it should be;

git remote add demo_app '[email protected]:levelone/demo_app.git'

Upvotes: 41

Related Questions