Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将GitHub存储库中的文件转换为Gist_Git_Github_Gist - Fatal编程技术网

如何将GitHub存储库中的文件转换为Gist

如何将GitHub存储库中的文件转换为Gist,git,github,gist,Git,Github,Gist,我想做的是相反的。我在GitHub repo中有一个文件夹,其中包含一个d3可视化,我希望继续对其进行更改。如果能在bl.ocks.org上显示该回购协议的“要点”版本,我会很高兴,在我满意后,我可以在主回购协议中推送更改 另一个类似的问题是,但答案描述了步骤gist->bl.ocks.org。我不确定githup repo->gist的步骤。实现这一点的最佳方法是什么?首先,请注意Gist不支持目录。要将存储库导入gist,请执行以下步骤: 创建新的gist并在本地克隆(用gist id替换虚

我想做的是相反的。我在GitHub repo中有一个文件夹,其中包含一个d3可视化,我希望继续对其进行更改。如果能在bl.ocks.org上显示该回购协议的“要点”版本,我会很高兴,在我满意后,我可以在主回购协议中推送更改


另一个类似的问题是,但答案描述了步骤gist->bl.ocks.org。我不确定githup repo->gist的步骤。实现这一点的最佳方法是什么?

首先,请注意Gist不支持目录。要将存储库导入gist,请执行以下步骤:

  • 创建新的gist并在本地克隆(用gist id替换虚拟id):

  • cd
    到该目录

  • 从GitHub存储库中提取和合并:

    git pull git@github.com:<user>/<repo>.git
    
  • 再次注意,如果您有目录,则必须删除并提交它们:

    rm -rf some-directory
    git commit -m 'Removed some-directory' .
    
    使用上述步骤,将保留项目历史记录。如果你不关心历史,你总是可以在你的要点中推送文件。假设您有一个包含多个文件夹的存储库,并且希望为每个文件夹创建一个要点。您将重复下面的步骤(或者脚本可以执行此操作):


    谢谢,但是Gist不支持目录是什么意思?所以我有一个回购协议,有几个文件夹。每个文件夹中都有一个独立的d3可视化——每个文件夹都包含index.html、style.css等。我可以通过这种方式将每个文件夹中的内容导入单独的GIST吗?@Andre5您必须为每个文件夹创建不同的GIST。如果您想使流程自动化,您可能需要使用。是的,这正是我想要做的,为每个GIST创建不同的GIST。你的指示在这种情况下适用吗?@Andre5在这种情况下,你只需要复制(
    cp
    )要点中的内容并提交即可。请看编辑。啊,谢谢你的澄清,我现在就试试。
    git push
    
    rm -rf some-directory
    git commit -m 'Removed some-directory' .
    
    git clone git@gist.github.com:<gist-id>.git
    cd <gist-id>
    cp ../path/to/your/github/repository/and/some/folder/* .
    git add .
    git commit -m 'Added the Gist files' .
    git push
    
    $ git push
    Counting objects: 32, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (21/21), done.
    Writing objects: 100% (32/32), 7.35 KiB | 0 bytes/s, done.
    Total 32 (delta 10), reused 0 (delta 0)
    remote: Gist does not support directories.
    remote: These are the directories that are causing problems:
    remote: foo
    To git@gist.github.com:792.....0b79.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'git@gist.github.com:79.......9.git'