【问题标题】:Ceate github codespace from current git directory repository?从当前 git 目录存储库创建 github 代码空间?
【发布时间】:2022-07-13 23:08:06
【问题描述】:

好时光!

我想通过终端从当前的 git 仓库在 Github 上创建一个新的代码空间。

我可以使用此参数从gh 创建代码空间

$ gh codespace create
? Repository: [? for help, tab for suggestions]

然后以用户名/repo-name 格式输入 repo 名称。

【问题讨论】:

    标签: git github codespaces


    【解决方案1】:

    您可以从 git URL 中获取用户名/repo-name 格式的 repo 名称,然后从中创建一个代码空间。

    1. 获取 git 存储库 URL
    git config --get remote.origin.url
    
    1. 从 URL 中删除域和 .git 以具有 username/repo-name 格式
    $ git config --get remote.origin.url  | sed 's/https:\/\/github\.com\///' | sed 's/\.git$//'
    
    1. gh 命令的管道名称
    $ git config --get remote.origin.url  | sed 's/https:\/\/github\.com\///' | sed 's/\.git$//' | xargs gh codespace create -r
    

    【讨论】:

      猜你喜欢
      • 2013-12-05
      • 2011-01-11
      • 2020-11-05
      • 2019-11-06
      • 2016-09-19
      • 2015-10-21
      • 1970-01-01
      • 1970-01-01
      • 2017-08-08
      相关资源
      最近更新 更多