LoginSignup
3
0

More than 3 years have passed since last update.

Jupyter学習ノート_005

Last updated at Posted at 2020-01-12

GitHubのリポジトリをgoogle colabにcloneする方法

下記の手順です。

  • google drive をマウントする
google_drive.py
from google.colab import drive
drive.mount('/content/drive')
  • git clone で指定した場所にリポジトリを作成する
git_clone.py
import shutil
import os

#カレントディレクトリを変更する
os.chdir('/content/drive/My Drive')
cur_dir = os.getcwd()
git_name = '/MongoDB_PyMongo_Tutorial'
git_folder = cur_dir + git_name

#存在すれば削除する
if os.path.exists(git_folder):
    shutil.rmtree(git_folder)

#クローンする
!git clone https://github.com/Giffy/MongoDB_PyMongo_Tutorial.git
  • 実施結果
    git_clone
3
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0