如何将文件从 colab 直接复制到 github 存储库? (可以将笔记本保存在 Github 仓库中)
How can I copy a file from colab to github repo directly? (It is possible to save the notebook in the Github repo)
如何将 colab notebook 生成的文件直接保存到 github 存储库?
可以假设笔记本是从 github 存储库打开的,并且可以(同一个笔记本)保存到相同的 github 存储库。
Google Colaboratory 与 github 的集成往往不足,但是您可以从笔记本内部 运行 bash 命令。这些允许您访问和修改生成的任何数据。
您需要在 github 上生成一个令牌,以允许访问您要将数据保存到的存储库。 See here for how to create a personal access token.
获得该令牌后,您可以从笔记本内部 运行 git 命令克隆存储库,添加所需的任何文件,然后上传它们。 This post here provides an overview of how to do it in depth.
也就是说,这种方法有点麻烦,它可能比 configure colab to work over an SSH connection. Once you do that, you can mount a folder on the colab instance to a folder on your local machine using sshfs. This will allow you to access the colab as though it were any other folder on your machine, including opening it in your IDE, viewing files in a file browser, and cloning or updating git repositories. This goes more in depth on that.
更可取
这些是我能够确定的最佳选择,我希望其中之一可以为您所用。
如何将 colab notebook 生成的文件直接保存到 github 存储库? 可以假设笔记本是从 github 存储库打开的,并且可以(同一个笔记本)保存到相同的 github 存储库。
Google Colaboratory 与 github 的集成往往不足,但是您可以从笔记本内部 运行 bash 命令。这些允许您访问和修改生成的任何数据。
您需要在 github 上生成一个令牌,以允许访问您要将数据保存到的存储库。 See here for how to create a personal access token.
获得该令牌后,您可以从笔记本内部 运行 git 命令克隆存储库,添加所需的任何文件,然后上传它们。 This post here provides an overview of how to do it in depth.
也就是说,这种方法有点麻烦,它可能比 configure colab to work over an SSH connection. Once you do that, you can mount a folder on the colab instance to a folder on your local machine using sshfs. This will allow you to access the colab as though it were any other folder on your machine, including opening it in your IDE, viewing files in a file browser, and cloning or updating git repositories. This goes more in depth on that.
更可取这些是我能够确定的最佳选择,我希望其中之一可以为您所用。