【问题标题】:Add a new Project to GitHub via Bash command? [duplicate]通过 Bash 命令将新项目添加到 GitHub? [复制]
【发布时间】:2015-02-11 22:32:30
【问题描述】:

是否可以创建一个新项目并将该新项目推送到 GitHub,而不必打开浏览器,登录到 Github,然后创建一个新项目供您通过 GitHub 站点推送?

【问题讨论】:

  • 是的,请关闭/删除,dup,谢谢

标签: git github


【解决方案1】:

没有。

您始终必须先在 GitHub 中创建存储库。

【讨论】:

    【解决方案2】:

    技术上你可以。但是你需要使用 Github 提供的API's

    还有一个用 python 编写的包装器,它实现了所有这些:查看here

    【讨论】:

      【解决方案3】:

      你不能。 Github 是 git 的包装器,它不允许你这样做。 原因是在 github repos 中有 github 权限,不能通过 git 管理。

      同样的问题:How to create a new repo at Github using git bash?

      另一种方法可能是使用 github API: https://developer.github.com/v3/repos/#create

      【讨论】:

        【解决方案4】:

        您可以将其添加到您的 .bash_profile:

        echo 'mkrepo () { curl -u "<username>" https://api.github.com/user/repos -d "{\"name\":\"$@\"}" ; }' >> ~/.bash_profile
        
        source ~/.bash_profile
        

        然后输入mkrepo &lt;new-repo-name&gt; 它会创建它。 (&lt;username&gt; 是您在 github 上的用户名,&lt;new-repo-name&gt; 是您要调用的新存储库。

        【讨论】:

          猜你喜欢
          • 2020-04-19
          • 2020-08-21
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-03-22
          • 1970-01-01
          • 2019-08-10
          相关资源
          最近更新 更多