Skip to content

Instantly share code, notes, and snippets.

@dcramer
Created February 13, 2015 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcramer/93a088759f532c3a398f to your computer and use it in GitHub Desktop.
Save dcramer/93a088759f532c3a398f to your computer and use it in GitHub Desktop.
>>> import subprocess
>>> proc = subprocess.Popen(['git', 'clone', 'git@github.com:getsentry/sentry.git', '/tmp/ds-repo-1'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>>> print(proc.communicate())
("Cloning into '/tmp/ds-repo-1'...\n", None)
@vartec
Copy link

vartec commented Feb 13, 2015

>>> subprocess.check_output("git clone git@github.com:getsentry/sentry.git /tmp/ds-repo-1", shell=True)
Cloning into '/tmp/ds-repo-1'...
remote: Counting objects: 76488, done.
remote: Compressing objects: 100% (425/425), done.
remote: Total 76488 (delta 285), reused 0 (delta 0)
Receiving objects: 100% (76488/76488), 31.78 MiB | 1.01 MiB/s, done.
Resolving deltas: 100% (41870/41870), done.
Checking connectivity... done.

raises CalledProcessError on non-zero exit code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment