将repo推送到远程存储库(GitHub)

时间:2016-08-09 20:40:21

标签: git github terminal push

我是Git / GitHub的新手。试图将我的文件推送到我已设置的新仓库,但它无法正常工作。这是我的过程:

  1. 在GitHub上设置回购。
  2. 在回购时初始化远程。 git remote add origiN <URL>
  3. 检查一下没问题。 git remote -v
  4. 这似乎都是计划,因为终端返回

    origiN  <URL> (fetch)
    origiN  <URL> (push)
    

    ......正如所料。

    然后,当我运行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>
    
    and then push using the remote name
    
        git push <name>
    

    ...但我以为我已经配置了远程存储库?

    我错过了什么?

2 个答案:

答案 0 :(得分:2)

name

然后你可以git push -u origin master

答案 1 :(得分:2)

psydroyd在我打字时回答,但这里有更多细节:

存储库可以有多个遥控器。您可以通过运行:

直接推送到远程
git push <remote> <branch>

但如果您希望git push在没有任何其他参数的情况下工作,则可以使用--set-upstream选项,即-u,如下所示:

git push -u origin master

这会设置您的本地分支以跟踪远程master分支。在此之后,您可以运行:

git push
相关问题