git push >> fatal: no configured push destination
Asked Answered
M

10

73

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.

Mangosteen answered 5/4, 2012 at 17:11 Comment(2)
Very good question. Most tutorials seem to be missing one or two steps, making it impossible to push your changes.Unwonted
I got the same error and then I found out that it was directory-related issue. I was not pushing from the right directory where the repo is settled.Judiejudith
S
40

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'
Smudge answered 5/4, 2012 at 17:25 Comment(2)
After doing this I keep having following error: [email protected]: Permission denied (publickey)Ury
That's because it's a private repositoryBouzoun
B
60

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
Bodhisattva answered 5/4, 2012 at 17:25 Comment(11)
It works! @Bodhisattva but unfortunately I'm stuck right after I push once again... After using: git push demo_app it outputs a Password Authentication, and after successfully logging in it displays: No refs in common and none specified; doing nothing; perhaps you should specify a branch such as 'master'. Everything-up-to-date i don't get it..Mangosteen
@Marc if it asks for a password, then you must have missed a configuration allowing you to authenticate to GitHub as the rightful owner of demo_app. See for instance (with an https remote GitHub address) #7129732 or (more complete) https://mcmap.net/q/14105/-syncing-with-github/…Bodhisattva
the first link didn't change the output of my push.. i'm curious on how to set my < login_internet >, < password_internet >, @ aproxy, aport ... i'm kinda lost :( sorry about that. hope i'm not bugging you for your help..Mangosteen
@Marc: you only need to setup that if you do access internet through a proxy.Bodhisattva
oh ok.. i access the net through our wifi here at home. i hope that helps? so yea when i push $ git push it displays this text error: error setting certificate verify locations: CA file: \bin\curl-ca-bundle.crt CApath: none while accessing https:\\[email protected]/levelone/demo_app.git/info/refs fatal:HTTPS request failed do i need my rails server on while i push it? or i do have to set up my proxy?Mangosteen
and i tried cloning it.. and destination path 'demo app' already exists and is not an empty directory.Mangosteen
@Marc check your global git config to set the CA file path appropriately: https://mcmap.net/q/142411/-github-error-cloning-my-private-repository. And when you clone, always do it by specifying a root directory which doesn't exist yet.Bodhisattva
I am on bitbucket when I am doing this git remote add abc-blog '[email protected]:sooraz/abc-blog.git' I am getting fatal: remote abc-blog already exists and then can't push it...Legislature
@Legislature that should be a separate question in its own, not a comment burried under a three-years old answer.Bodhisattva
Sorry about that.. I saw your last active was just 10 minutes back and hence the comment.Legislature
@Legislature sure, I am always there (meta.stackexchange.com/questions/122976/…), but your question deserves more visibility: make one, for others (than just me) to answer to.Bodhisattva
S
40

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'
Smudge answered 5/4, 2012 at 17:25 Comment(2)
After doing this I keep having following error: [email protected]: Permission denied (publickey)Ury
That's because it's a private repositoryBouzoun
R
6

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
Ribaudo answered 29/12, 2020 at 20:47 Comment(0)
B
2

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.

Burnside answered 9/11, 2022 at 22:17 Comment(0)
T
1

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
Tankersley answered 9/8, 2023 at 8:58 Comment(0)
V
0

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'
Val answered 3/4, 2021 at 15:51 Comment(1)
This is exactly what the already accepted answer says.Cene
C
0

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.

Candide answered 2/9, 2021 at 7:10 Comment(1)
What is "sync"?Trusting
P
0

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

Pazice answered 21/9, 2021 at 20:35 Comment(0)
A
0

Here is how I resolve the same issue:

  1. create repository

  2. git branch -M main

  3. git push -u origin main

Ancipital answered 12/6, 2022 at 15:59 Comment(0)
B
0

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.

Bifocals answered 24/12, 2023 at 17:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.