Ion*_*zău 23
首先,请注意Gist不支持目录.要将存储库导入gist,请执行以下步骤:
创建一个新的要点并在本地克隆它(用您的Gist id替换虚拟ID):
git clone git@gist.github.com:792bxxxxxxxxxxxxxxx9.git
Run Code Online (Sandbox Code Playgroud)cd 到那个gist目录
从GitHub存储库中拉取并合并:
git pull git@github.com:<user>/<repo>.git
Run Code Online (Sandbox Code Playgroud)推动您的更改
git push
Run Code Online (Sandbox Code Playgroud)再次注意,如果您有目录,则必须删除并提交它们:
rm -rf some-directory
git commit -m 'Removed some-directory' .
Run Code Online (Sandbox Code Playgroud)
使用上述步骤,将保留项目历史记录.如果您不关心历史记录,可以随时按下Gist中的文件.假设您有一个包含多个文件夹的存储库,并且您希望每个文件夹都创建一个Gist.您将重复以下步骤(或脚本可以执行此操作):
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
Run Code Online (Sandbox Code Playgroud)
Gist与GitHub的工作方式不同:
Gist是一种与其他人共享片段和粘贴的简单方法.所有要点都是Git存储库,因此它们可以自动进行版本化,可分叉并可从Git中使用.
但是,如果您尝试在Gists中推送目录,则会从远程获取错误:
$ 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'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5419 次 |
| 最近记录: |