From 26ffe86240ca12508e23c1a58e76eadf53d531e6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 28 Aug 2022 16:24:25 -0400 Subject: [PATCH 1/6] Update docs to configure 'main' to pull from 'upstream'. Ref python/core-workflow#475. --- getting-started/setup-building.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 3a1b04c09..89b96de59 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -81,13 +81,19 @@ You will only need to execute these steps once: $ cd cpython $ git remote add upstream git@github.com:python/cpython.git -7. Verify that your setup is correct:: +7. Configure ``git`` to pull main from the ``upstream`` remote:: + + $ git config --local branch.main.remote upstream + +8. Verify that your setup is correct:: $ git remote -v origin git@github.com:/cpython.git (fetch) origin git@github.com:/cpython.git (push) upstream git@github.com:python/cpython.git (fetch) upstream git@github.com:python/cpython.git (push) + $ git config branch.main.remote + upstream If you did everything correctly, you should now have a copy of the code in the ``cpython`` directory and two remotes that refer to your own GitHub fork From 89ee036a3a8dcd779dbb6181a8ae5e3c5bfe534b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 5 Sep 2022 12:29:32 -0400 Subject: [PATCH 2/6] Quote 'main'. Co-authored-by: Ezio Melotti --- getting-started/setup-building.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 89b96de59..30d70a6f9 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -81,7 +81,7 @@ You will only need to execute these steps once: $ cd cpython $ git remote add upstream git@github.com:python/cpython.git -7. Configure ``git`` to pull main from the ``upstream`` remote:: +7. Configure ``git`` to pull ``main`` from the ``upstream`` remote:: $ git config --local branch.main.remote upstream From 879e759feb8020cdebbd8947322e3c0c1867ef86 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 5 Sep 2022 12:54:48 -0400 Subject: [PATCH 3/6] Direct 'upstream' push to the user's fork. Now pull comes from upstream and push goes to origin. --- getting-started/setup-building.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 30d70a6f9..26c40e211 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -60,7 +60,7 @@ The CPython repo is hosted on GitHub. To get a copy of the source code you shoul :ref:`fork the Python repository on GitHub `, :ref:`create a local clone of your personal fork, and configure the remotes `. -You will only need to execute these steps once: +You will only need to execute these steps once per machine: 1. Go to https://github.com/python/cpython. @@ -85,13 +85,18 @@ You will only need to execute these steps once: $ git config --local branch.main.remote upstream -8. Verify that your setup is correct:: +8. Since one should never attempt to push to ``upstream``, configure + ``git`` to push always to ``origin``:: + + $ git remote set-url --push upstream git@github.com:/cpython.git + +9. Verify that your setup is correct:: $ git remote -v origin git@github.com:/cpython.git (fetch) origin git@github.com:/cpython.git (push) upstream git@github.com:python/cpython.git (fetch) - upstream git@github.com:python/cpython.git (push) + upstream git@github.com:/cpython.git (push) $ git config branch.main.remote upstream From 3792dee7edb99e9490902fd01190b21f9a36c4bf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Oct 2022 14:48:48 -0400 Subject: [PATCH 4/6] Apply the changes also to the git boot camp. --- getting-started/git-boot-camp.rst | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/getting-started/git-boot-camp.rst b/getting-started/git-boot-camp.rst index 4d6aab073..3ba59cd4f 100644 --- a/getting-started/git-boot-camp.rst +++ b/getting-started/git-boot-camp.rst @@ -47,7 +47,7 @@ You will only need to do this once. Cloning a Forked CPython Repository ----------------------------------- -You will only need to do this once. From your command line:: +You will only need to do this once per machine. From your command line:: git clone git@github.com:/cpython.git @@ -58,6 +58,18 @@ It is also recommended to configure an ``upstream`` remote repository:: You can also use SSH-based or HTTPS-based URLs. +Configure the Remotes +--------------------- + +Configure ``git`` to pull ``main`` from the ``upstream`` remote:: + + git config --local branch.main.remote upstream + +Since one should never attempt to push to ``upstream``, configure +``git`` to push always to ``origin``:: + + git remote set-url --push upstream git@github.com:/cpython.git + Listing the Remote Repositories ------------------------------- @@ -71,7 +83,14 @@ and ``upstream`` pointing to the official CPython repository:: origin git@github.com:/cpython.git (fetch) origin git@github.com:/cpython.git (push) upstream git@github.com:python/cpython.git (fetch) - upstream git@github.com:python/cpython.git (push) + upstream git@github.com:/cpython.git (push) + +To verify the upstream for ``main``:: + + git config branch.main.remote + +It should emit ``upstream``, indicating to track/pull changes for ``main`` from the +``upstream`` remote. .. _set-up-name-email: From dc5ada88a6714a5f7fe5087e0d6b01e9bbf5ac96 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 12 Oct 2022 08:49:55 -0400 Subject: [PATCH 5/6] Prefer https for upstream fetch. Co-authored-by: C.A.M. Gerlach --- getting-started/setup-building.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 26c40e211..db8b07db6 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -79,7 +79,7 @@ You will only need to execute these steps once per machine: 6. Configure an ``upstream`` remote:: $ cd cpython - $ git remote add upstream git@github.com:python/cpython.git + $ git remote add upstream https://github.com/python/cpython.git 7. Configure ``git`` to pull ``main`` from the ``upstream`` remote:: From 3dee9ad39604e44786cebd217aee8978e26cfb2c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 12 Oct 2022 08:54:08 -0400 Subject: [PATCH 6/6] Update expectations and sync guidance for d7e9065cbf37. Remove superfluous .git from https. --- getting-started/git-boot-camp.rst | 4 ++-- getting-started/setup-building.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/getting-started/git-boot-camp.rst b/getting-started/git-boot-camp.rst index 3ba59cd4f..f5854da56 100644 --- a/getting-started/git-boot-camp.rst +++ b/getting-started/git-boot-camp.rst @@ -54,7 +54,7 @@ You will only need to do this once per machine. From your command line:: It is also recommended to configure an ``upstream`` remote repository:: cd cpython - git remote add upstream git@github.com:python/cpython.git + git remote add upstream https://github.com/python/cpython You can also use SSH-based or HTTPS-based URLs. @@ -82,7 +82,7 @@ and ``upstream`` pointing to the official CPython repository:: origin git@github.com:/cpython.git (fetch) origin git@github.com:/cpython.git (push) - upstream git@github.com:python/cpython.git (fetch) + upstream https://github.com/python/cpython (fetch) upstream git@github.com:/cpython.git (push) To verify the upstream for ``main``:: diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index db8b07db6..8d09ea988 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -79,7 +79,7 @@ You will only need to execute these steps once per machine: 6. Configure an ``upstream`` remote:: $ cd cpython - $ git remote add upstream https://github.com/python/cpython.git + $ git remote add upstream https://github.com/python/cpython 7. Configure ``git`` to pull ``main`` from the ``upstream`` remote:: @@ -95,7 +95,7 @@ You will only need to execute these steps once per machine: $ git remote -v origin git@github.com:/cpython.git (fetch) origin git@github.com:/cpython.git (push) - upstream git@github.com:python/cpython.git (fetch) + upstream https://github.com/python/cpython (fetch) upstream git@github.com:/cpython.git (push) $ git config branch.main.remote upstream