Skip to content

Recommend GitHub CLI for easier bootstrapping #946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 18 additions & 30 deletions getting-started/setup-building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://git-scm.com>`_ for version control. The git
command line program is named ``git``; this is also used to refer to git
Expand All @@ -41,14 +41,20 @@ itself. git is easily available for all common operating systems.
such as `TortoiseGit <https://tortoisegit.org/>`_ or
`GitHub Desktop <https://desktop.github.com/>`_.

CPython source is managed through GitHub, who provide a
`CLI <https://cli.github.com/>`_ (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 <set-up-name-email>` and create
`an SSH key <https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/>`_
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 <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 <autocrlf>`.


.. _checkout:
Expand All @@ -62,35 +68,17 @@ clone of your personal fork, and configure the remotes <clone-your-fork>`.

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/{<username>}/cpython`.

5. Clone your GitHub fork (replace ``<username>`` with your username)::

$ git clone git@github.com:<username>/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:<your-username>/cpython.git

9. Verify that your setup is correct::
3. Verify that your setup is correct::

$ git remote -v
origin git@github.com:<your-username>/cpython.git (fetch)
Expand Down