--recursive
パラメータ ( 、 )を使用して git リポジトリのクローンを作成したいのです-b <branch>
が、次のエラーが発生します。
Traceback (most recent call last):
File "./git-clone.py", line 15, in <module>
r = git.Repo.clone(repo_dir, b=branch, recursive=git_url)
TypeError: unbound method clone() must be called with Repo instance as first argument (got str instance instead)
これが私のコードです:
#!/usr/bin/env python
import git
import os
import shutil
git_url = "<url>..."
repo_dir = "/home_local/user/git-repository"
branch = "branch"
if os.path.exists(repo_dir):
shutil.rmtree(repo_dir)
r = git.Repo.clone(repo_dir, b=branch, recursive=git_url)
正常に機能するものに置き換えgit.Repo.clone
た場合git.Repo.clone_from
、このコマンドは私のパラメーターを受け入れません。