【问题标题】:Creating a Github repository from local terminal [closed]从本地终端创建 Github 存储库 [关闭]
【发布时间】:2013-03-31 12:57:15
【问题描述】:

如何从本地终端创建 Github 存储库?

更新:

我们必须创建存储库并将数据从一个应用程序上传到github,而不是在应用程序系统中存储任何数据......这是可能的

实际上,很多用户都会登录到这个应用程序。他们将在预览框中输入代码并检查结果。在这里,用户可以将此代码存储到 github 中。

【问题讨论】:

    标签: git github


    【解决方案1】:

    您可以使用hub

    hub create repo
    

    【讨论】:

    • 错误:'create' 必须从 git 存储库中运行
    • 而问题是???只需使用git init 创建一个,然后调用hub create
    • 好的,谢谢。现在它正在工作
    • Michael Wild : 我们必须创建存储库并将数据从一个应用程序上传到 github ,而不是在应用程序系统中存储任何数据......有可能吗?
    • 我真的怀疑 that 是可能的。你不能再使用hub(而是直接使用github API),你不能使用git本身来推送数据,你需要一些可以从内存中发送数据的东西。也许你可以通过libgit2 实现这一点,我真的不知道。
    【解决方案2】:

    您不创建 Github 存储库,而是创建 Git 存储库。然后可以将其与 Github 一起用作遥控器。如果您在 Github 上创建了存储库,则可以使用以下命令将本地存储库与 Github 远程连接:

    $ mkdir ~/Hello-World
    # Creates a directory for your project called "Hello-World" in your user directory
    
    $ cd ~/Hello-World
    # Changes the current working directory to your newly created directory
    
    $ git init# Sets up the necessary Git files
    # Initialized empty Git repository in /Users/you/Hello-World/.git/
    
    
    $ git remote add origin https://github.com/username/Hello-World.git
    # Creates a remote named "origin" pointing at your GitHub repository
    
    $ git push origin master
    # Sends your commits in the "master" branch to GitHub
    

    发件人:https://help.github.com/articles/create-a-repo

    【讨论】:

    • 我收到错误:致命:github.com/srinivas47n/git.git/info/refs 未找到:您是否在服务器上运行了 git update-server-info?
    • @srinivas 在推送更改之前,您是否在 Github 上创建了存储库?
    • 不,我没有装箱。我想从本地系统的终端创建
    • 你能检查更新的问题吗
    • @srinivas 如果你想在 Github 上存储你的提交数据,你必须在那里创建一个存储库。除非您使用 Github API,否则您无法从本地终端在 Github 服务器上远程创建存储库。
    【解决方案3】:

    Defunkt's hub tool 可以做到这一点

    【讨论】:

      【解决方案4】:

      http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server 从本地服务器设置 git 的完整教程。

      【讨论】:

      • 那与github无关
      • @NevikRehnel,github 也使用 git 命令,所以它应该可以工作。
      • 但它没有回答 OP 的问题。他问的是如何在github上创建一个repo,而不是如何设置一个git服务器
      • @NevikRehnel,感谢您的更新。但是,他问如何从本地终端在 github 上创建一个 repo。
      猜你喜欢
      • 1970-01-01
      • 2012-06-28
      • 1970-01-01
      • 1970-01-01
      • 2011-08-09
      • 2014-03-23
      • 1970-01-01
      • 2018-04-30
      • 1970-01-01
      相关资源
      最近更新 更多