I'm trying to use the clone_from
function from the gitpytho
n library and I would like to pass the git clone
parameter --no-checkout
to the command.
According to the documentation, parameters must be passed as **kwargs
and from what I understand, this must be a dictionary where the keys are the git parameter and the values corresponds to parameter values. My problem is that --no-checkout
does not take any parameter values.
I have tried something like:
clone_kwargs = {'no-checkout'}
repo.clone_from(clone_url,local_repo_path,None,None,**clone_kwargs)''
and
clone_kwargs = {'no-checkout':''}
repo.clone_from(clone_url,local_repo_path,None,None,**clone_kwargs)
and
clone_kwargs = {'':'no-checkout'}
repo.clone_from(clone_url,local_repo_path,None,None,**clone_kwargs)
But all of these attempts fail. So, how do I best clone a repo without checking it out?
This issue in the gitpython project explains what you need to do:
Repo.clone_from(url, to, no_checkout=True)
So in your case it would be:
repo.clone_from(clone_url, local_repo_path, no_checkout=True)