【问题标题】:how to mount a github repository as the current directory folder in google colab?如何将 github 存储库挂载为 google colab 中的当前目录文件夹?
【发布时间】:2021-05-10 12:54:08
【问题描述】:

我目前正在从我的 Google 云端硬盘加载图片。

但问题是,这些图像在我的驱动器中,当我与其他人共享我的 colab 笔记本时,他们无法运行它,因为它需要我的身份验证代码才能访问驱动器图像。

所以我想如果我将数据文件夹上传到 Github 存储库并将该存储库设为公开将允许任何人获取数据(在我的情况下为图像文件夹)。因此运行 colab 代码不需要身份验证。

我不知道如何将目录作为 Google Drive 挂载到 Github 存储库。

from google.colab import drive
drive.mount('/content/drive/') # this will set my  google drive folder as the notebook directory.

是否可以对 github 存储库进行类似的挂载?

【问题讨论】:

    标签: python github google-colaboratory mount


    【解决方案1】:

    您可以像这样通过在代码单元中运行 git 直接克隆存储库。

    !git clone https://github.com/yourusername/yourpublicrepo.git
    

    这将创建一个名为 yourpublicrepo 的文件夹。

    【讨论】:

    • 哇! ,非常感谢,我试过了,成功了
    猜你喜欢
    • 2020-04-21
    • 2017-06-21
    • 2019-04-10
    • 2020-06-25
    • 1970-01-01
    • 2021-06-06
    • 2022-01-09
    • 2020-04-24
    • 2019-06-11
    相关资源
    最近更新 更多