diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index c6f8b3a7e..06f24fb29 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -25,8 +25,8 @@ and are provided for development and testing purposes only. .. _vcsetup: -Install ``git`` -=============== +Install ``git`` and ``gh`` +========================== CPython is developed using `git `_ for version control. The git command line program is named ``git``; this is also used to refer to git @@ -41,14 +41,20 @@ itself. git is easily available for all common operating systems. such as `TortoiseGit `_ or `GitHub Desktop `_. + CPython source is managed through GitHub, who provide a + `CLI `_ (Command Line Interface) for working + with GitHub. Follow the installation instructions from that page, after + which you should have a ``gh`` command available. + - **Configure** - Configure :ref:`your name and email ` and create - `an SSH key `_ - as this will allow you to interact with GitHub without typing a username - and password each time you execute a command, such as ``git pull``, - ``git push``, or ``git fetch``. On Windows, you should also - :ref:`enable autocrlf `. + Use ``gh`` to set up an SSH key:: + + $ gh auth login -h GitHub.com + + Follow the prompts to configure an SSH key and install that with GitHub. + + On Windows, you should also :ref:`enable autocrlf `. .. _checkout: @@ -62,35 +68,17 @@ clone of your personal fork, and configure the remotes `. You will only need to execute these steps once per machine: -1. Go to https://github.com/python/cpython. - -2. Press :guilabel:`Fork` on the top right. - -3. When asked where to fork the repository, choose to fork it to your username. - -4. Your fork will be created at :samp:`https://github.com/{}/cpython`. - -5. Clone your GitHub fork (replace ```` with your username):: - - $ git clone git@github.com:/cpython.git - - (You can use both SSH-based or HTTPS-based URLs.) - -6. Configure an ``upstream`` remote:: +1. Fork and clone the project:: + $ gh repo fork python/cpython --clone --remote $ cd cpython - $ git remote add upstream git@github.com:python/cpython.git - -7. Configure ``git`` to pull ``main`` from the ``upstream`` remote:: - - $ git config --local branch.main.remote upstream -8. Since one should never attempt to push to ``upstream``, configure +2. 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:: +3. Verify that your setup is correct:: $ git remote -v origin git@github.com:/cpython.git (fetch)