From 158bc981130bfbe214190cac19da228d1f321fe1 Mon Sep 17 00:00:00 2001 From: Jonas Trappenberg Date: Mon, 9 Feb 2015 15:15:15 -0800 Subject: Replace GIT_SSH with GIT_SSH_COMMAND for SSH key management. Also move untestable documentation out of test. Related: #234, #242 --- doc/source/tutorial.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'doc/source/tutorial.rst') diff --git a/doc/source/tutorial.rst b/doc/source/tutorial.rst index 0d60f0aa..e86fd8d5 100644 --- a/doc/source/tutorial.rst +++ b/doc/source/tutorial.rst @@ -331,12 +331,11 @@ You can easily access configuration information for a remote by accessing option :start-after: # [26-test_references_and_objects] :end-before: # ![26-test_references_and_objects] -You can also specify per-call custom environments using a new context manager on the Git command +You can also specify per-call custom environments using a new context manager on the Git command, e.g. for using a specific SSH key. -.. literalinclude:: ../../git/test/test_docs.py - :language: python - :start-after: # [32-test_references_and_objects] - :end-before: # ![32-test_references_and_objects] + ssh_cmd = 'ssh -i id_deployment_key' + with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd): + repo.remotes.origin.fetch() Submodule Handling ****************** -- cgit v1.2.1 From 6cc1e7e08094494916db1aadda17e03ce695d049 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 8 Apr 2015 14:58:33 +0200 Subject: docs(tutorial): add pre-v2.3 GIT_SSH example It goes along with the new one advertising the GIT_SSH_COMMAND environment variable. Related to #256 --- doc/source/tutorial.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/source/tutorial.rst') diff --git a/doc/source/tutorial.rst b/doc/source/tutorial.rst index e86fd8d5..84b3b5f5 100644 --- a/doc/source/tutorial.rst +++ b/doc/source/tutorial.rst @@ -331,11 +331,17 @@ You can easily access configuration information for a remote by accessing option :start-after: # [26-test_references_and_objects] :end-before: # ![26-test_references_and_objects] -You can also specify per-call custom environments using a new context manager on the Git command, e.g. for using a specific SSH key. +You can also specify per-call custom environments using a new context manager on the Git command, e.g. for using a specific SSH key. The following example works with `git` starting at *v2.3*. ssh_cmd = 'ssh -i id_deployment_key' with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd): repo.remotes.origin.fetch() + +This one sets a custom script to be executed in place of `ssh`, and can be used in `git` prior to *v2.3*. + + ssh_executable = os.path.join(rw_dir, 'my_ssh_executable.sh') + with repo.git.custom_environment(GIT_SSH=ssh_executable): + repo.remotes.origin.fetch() Submodule Handling ****************** -- cgit v1.2.1