Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Preferred cloning URL #130

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
ezio-melotti opened this issue Feb 23, 2017 · 7 comments
Closed

Preferred cloning URL #130

ezio-melotti opened this issue Feb 23, 2017 · 7 comments
Labels

Comments

@ezio-melotti
Copy link
Member

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 [email protected]: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?

@ezio-melotti ezio-melotti changed the title Preferred cloning url Preferred cloning URL Feb 23, 2017
@ncoghlan
Copy link
Contributor

ncoghlan commented Feb 23, 2017

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 [email protected]:<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 [email protected]:<your GitHub user name>/cpython.git
    

@berkerpeksag
Copy link
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.

@ncoghlan
Copy link
Contributor

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

@pfmoore
Copy link
Member

pfmoore commented Feb 23, 2017

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).

@warsaw
Copy link
Member

warsaw commented Feb 23, 2017

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 [email protected]: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

@willingc
Copy link
Collaborator

  1. Clone your fork:
git clone [email protected]:<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 [email protected]:<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
    

@willingc
Copy link
Collaborator

Closed by #140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants