Skip to content

Preferred cloning URL #130

Closed
Closed

Description

@ezio-melotti

So far I met a few different ways to get a clone:

git clone https://github.com/python/devguide
git clone https://github.com/python/devguide.git
git clone git@github.com:python/devguide.git

AFAICT there is no difference between the first two but when I use those it asks me for user/password whenever I try to push something, whereas if I use the third way it doesn't.
Is there a preferred form that we should use in the devguide? Are there other differences that should be noted? Do contributors and core devs use the same URL?

Activity

  1. changed the title [-]Preferred cloning url[/-] [+]Preferred cloning URL[/+] on Feb 23, 2017
  2. ncoghlan commented on Feb 23, 2017

    @ncoghlan
    Contributor

    The second form is the one GitHub offers for "Clone with HTTPS", while the last is the one it offers for "Clone with SSH", so I think it makes sense to stick with recommending those two and suggest:

    • the HTTPS form for "read-only" clones
    • the SSH form for "read-write" clones

    The default recommended flow would then be:

    1. Fork the cpython repo through the GitHub UI

    2. Clone your fork:

       git clone git@github.com:<your GitHub user name>/cpython.git
      
    3. Add a read-only upstream remote:

       cd cpython
       git remote add upstream https://github.com/python/cpython.git
       git fetch upstream
      

    Folks following the "lazy fork" model just reverse the roles of the two URLs:

    1. Clone the upstream repository directly:

       git clone https://github.com/python/cpython.git
      
    2. Fork the cpython repo through the GitHub UI

    3. Add a read-write pr remote:

       cd cpython
       git remote add pr git@github.com:<your GitHub user name>/cpython.git
      
  3. berkerpeksag commented on Feb 23, 2017

    @berkerpeksag
    Member

    Note that technically we don't have "read-write" clones anymore since we can't push directly to any branches on python/cpython. In any case, +1 for making the upstream (python/cpython)-origin (yourfork/cpython) model the default recommendation.

  4. ncoghlan commented on Feb 23, 2017

    @ncoghlan
    Contributor

    By read-write clones, I was referring to clones-of-your-fork, vs read-only clones of the primary repo.

  5. pfmoore commented on Feb 23, 2017

    @pfmoore
    Member

    Advantages of the https form:

    1. It works better behind a proxy (corporate proxies often don't allow custom protocols like git).
    2. You're using a consistent form for everything.

    The https form prompts for a password each time, but you can set up a git credential manager to address that (Windows git comes with git credential manager as part of the install).

  6. warsaw commented on Feb 23, 2017

    @warsaw
    Member

    I like how GitLab recommends getting a local copy of a pull request (which they call merge requests). They recommend using git fetch to grab the branch, then git co -b <name> FETCH_HEAD to check the branch out. I just fine it more intuitive, and easier to rebase locally, etc. Just FYI.

    E.g. from a Mailman MR:

    git fetch git@gitlab.com:msapiro/mailman.git alias_domains
    git checkout -b msapiro/mailman-alias_domains FETCH_HEAD
    

    I usually substitute something shorter for the -b option, e.g. -b issue1234

  7. willingc commented on Feb 25, 2017

    @willingc
    Collaborator
    1. Clone your fork:
    git clone git@github.com:<your GitHub user name>/cpython.git
    
    1. Clone your fork. Choose one of the following:

      SSH (when you have an SSH key set up for GitHub)

      git clone git@github.com:<your GitHub user name>/cpython.git
      

      HTTPS (when you do not have an SSH key set up or you are behind a proxy)

      git clone https://github.com/<your GitHub user name>/cpython.git
      
  8. willingc commented on Mar 19, 2018

    @willingc
    Collaborator

    Closed by #140

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions