git push heroku origin~damal:没有指定路径

Kun*_*nok 9 git heroku

我正在按照本教程https://www.railstutorial.org/book/static_pages#sec-sample_app_setup成功完成所有步骤(git commit和push on github,heroku login和heroku app creation),直到这个命令为止:

$ git push heroku master
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

$ git push heroku origin
$ git push heroku
Run Code Online (Sandbox Code Playgroud)

它导致了这个错误:

> fatal: No path specified. See 'man git-pull' for valid url syntax
Run Code Online (Sandbox Code Playgroud)

我尝试通过遵循这个答案解决它,但它对我不起作用.

在我尝试了最佳答案之后,这是我在.git中的配置文件:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/kunokdev/sample_app.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "heroku"]
    url = https://git.heroku.com/test774.git
    fetch = +refs/heads/*:refs/remotes/heroku/*
Run Code Online (Sandbox Code Playgroud)

有什么想法是什么问题?我正在使用Ubuntu 14.04操作系统.

$ git config --list | grep heroku

url.ssh://git@heroku.com.insteadof=https://git.heroku.com/
remote.heroku.url=https://git.heroku.com/test774.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
Run Code Online (Sandbox Code Playgroud)

Kun*_*nok 1

我设法解决了这个问题,所以我在这里分享解决方案。那么这些是从0到部署的步骤:

$ cd path/to/dir
$ git init
$ git add -A
$ git commit -m "Initialized"
$ heroku login
$ heroku create appname
$ heroku git:remote -a appname
$ git remote -v
Run Code Online (Sandbox Code Playgroud)

至此,我们就可以看出问题所在了。由于某些奇怪的原因,heroku 生成了无效的 URL。正如您在输出中看到的:(注意:我用作kunokdev应用程序名称)

heroku  ssh://git@heroku.comkunokdev.git (fetch)
heroku  ssh://git@heroku.comkunokdev.git (push)
origin  https://github.com/kunokdev/kunokdev.git (fetch)
origin  https://github.com/kunokdev/kunokdev.git (push)
Run Code Online (Sandbox Code Playgroud)

你看到前两行了吗?它有......heroku.comkunokdev.git而不是heroku.com/kunokdev.git正如 Ruby On Rails 小组中的一位好人所建议的那样;为了解决这个问题,我需要删除远程并添加修改后的远程,如下所示:

$ git remote rm heroku
$ git remote add heroku ssh://git@heroku.com/kunokdev.git
Run Code Online (Sandbox Code Playgroud)

此时使用时$ git push heroku master应该不会出现与无效路径 url 相关的错误。