简体   繁体   English

将它们克隆到协作室后无法查看Github Repos

[英]Can't view Github Repos after cloning them into Colaboratory

I cloned a Github Repository into Colaboratory although it was cloned but i couldn't view it in that particular folder. 我已将Github存储库克隆到Colaboratory中,尽管它已被克隆,但是我无法在该特定文件夹中查看它。 I changed into "drive" as my working directory but i don't know which directory is that on drive. 我将工作目录更改为“驱动器”,但不知道驱动器上的目录。 I moved into drive folder and viewed it's contents, it was present in the drive folder. 我移入驱动器文件夹并查看了它的内容,该内容存在于驱动器文件夹中。 Please tell me which is the drive folder on Google Drive. 请告诉我Google云端硬盘上的驱动器文件夹。 Thanks in advance. 提前致谢。

Colab runs on a new machine in the cloud. Colab在云中的新计算机上运行。 If you git clone in Colab, it won't appear in Gdrive. 如果您在Colab中进行git clone,它将不会出现在Gdrive中。 You need to mount it as shown here. 您需要按如下所示安装它。

How to Upload Many Files to Google Colab? 如何将许多文件上传到Google Colab?

First, mount Google Drive in Colab as follows: 首先,按照以下步骤在Colab中安装Google云端硬盘:

from google.colab import drive
drive.mount('/content/drive/')

Enter the authorization code to provide access to your Drive. 输入授权码以提供对云端硬盘的访问权限。


Next, cd into the folder you want: 接下来,cd进入所需的文件夹:

%cd '/content/drive/My Drive/[folder name]'


Lastly, git clone the GitHub repository: 最后,git clone GitHub存储库:

!git clone https://github.com/example/example_repo.git


You should now be able to see the repository and its contents in your Drive. 现在,您应该可以在云端硬盘中查看存储库及其内容。 Use !pwd or !ls to check if you are in the correct directory. 使用!pwd!ls检查您是否在正确的目录中。

Try to change Run type to GPU and retry the clone. 尝试将“运行类型”更改为GPU然后重试克隆。

I met the same problem when using default Jupyter notebook. 使用默认的Jupyter笔记本时,我遇到了相同的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM