9

When I try to push to Heroku, I get the following error messages.

[first_app]$git push heroku master
fatal: I don't handle protocol 'git@heroku.com:yourhttp'

I then took a look at the different versions of Heroku that I have and there seems to be more than one so I tried deleting it but got another error message.

[first_app]$ git remote set-url --delete heroku git@heroku.com:yourhttp://still-lake-3136.herokuapp.com/.git
fatal: Will not delete all non-push URLs

I searched for similar error messages but was not able to find anything to fix this one. Your help is greatly appreciated.

Here is my config file:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = git@github.com:wongsteven/first_app.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "heroku"]
    url = git@heroku.com:yourhttp://still-lake-3136.herokuapp.com/.git
    fetch = +refs/heads/*:refs/remotes/heroku/*
[heroku]
    remote = heroku

not able to push to heroku | git error: cannot handle https | heroku + git submodule needs authentication | error: "fatal: I don't handle protocol ``git` when using bundle install | Git/GitHub can't push to master

Community
  • 1
  • 1
Steven W.
  • 111
  • 1
  • 1
  • 5
  • What's the contents of your `.git/config` file? Post it in the answer. – Casper Jun 29 '13 at 00:24
  • Hey Casper, At first, I as having extreme difficulty finding the file ".git/config". I was then able to open the .git/config file by typing "subl .git/config" in the terminal. Is there any other way to retrieve this file? Thanks! – Steven W. Jul 03 '13 at 04:06

5 Answers5

11

Put quotes around the url of the Git repository (this worked for me. I'm using Windows 8.1)

Sevin7
  • 6,296
  • 4
  • 23
  • 31
  • This solution worked for me. I was running command: $ git remote add origin "https://github.com/MyUserName/my-test-repository.git" Then I was able to run command: $ git push --set-upstream origin master – Eric Milliot-Martinez Mar 14 '17 at 22:15
3

The error is in your configuration. This line:

[remote "heroku"]
    url = git@heroku.com:yourhttp://still-lake-3136.herokuapp.com/.git

Is complete nonsense. I don't know how that line ended up there. You must have copy-pasted something from somewhere the wrong way. My guess is it should look like this:

[remote "heroku"]
    url = git@heroku.com:still-lake-3136.git

If that does not work you should really follow the instruction here to initiate a remote repository:

https://devcenter.heroku.com/articles/git

In that case you can delete the whole [remote "heroku"] section (actually the 5 last lines) from your config file before proceeding with those instructions.

One of those two (editing the line, or reinitializing the repository) should fix your problem.

Casper
  • 33,403
  • 4
  • 84
  • 79
  • Hey Casper, I changed this line "url = git@heroku.com:yourhttp://still-lake-3136.herokuapp.com/.git" to "url = git@heroku.com:secret-brushlands-7492.git" and it seems to work now. – Steven W. Jul 03 '13 at 04:10
1

Git uses different protocols for you to "push" code this could be https/ssh etc

You probably have .git/config file in the root of you repository

It has config information for origin :

[remote "origin"]
#url = ssh://git@bitbucket.org/user/repo.git
url=git@heroku.com:myheroku.git
fetch = +refs/heads/*:refs/remotes/origin/*

If you see this the url information has git@something:repo.com

If you look at the url there you will see that it has something like this git@heroku.com:yourhttp(url) This is the problem, you have your apps url in the config

On the apps page on heroku you would find the uri for the git repo change the url to that and things should run fine

dusual
  • 2,097
  • 3
  • 19
  • 26
0

Hade same issue, tho cause of it was different from other solutions mentioned here.

Am using SourceTree and when adding remote url, accidentally added extra prefix-space.

My config (wrong)

url = " ssh://url.com/path/repo.git"

Correct

url = ssh://url.com/path/repo.git
Deko
  • 1,028
  • 2
  • 15
  • 24
0

I've seen this issue many times and always on Windows computers. When you paste from the clipboard Windows inserts an invisible extra character at the start of the content you paste.

The solution is to delete the first character of the pasted content along with the character before and retype.

Mark Tyers
  • 2,961
  • 4
  • 29
  • 52