RFR: Section on cloning [v3]

Kevin Rushforth kcr at openjdk.java.net
Thu Aug 12 23:38:32 UTC 2021


On Thu, 12 Aug 2021 23:03:39 GMT, Jesper Wilhelmsson <jwilhelm at openjdk.org> wrote:

>> src/index.md line 999:
>> 
>>> 997: 
>>> 998:     $ git clone git at github.com:JesperIRL/jdk.git
>>> 999:     $ git remote add upstream git at github.com:openjdk/jdk.git
>> 
>> I typically recommend using https for the "fetch" URL and "ssh" (i.e., `git@`) for the push URL. More importantly, I don't recommend using ssh at all for the upstream repo, since it is read-only for developers. Here is my suggestion:
>> 
>> 
>> $ git clone https://github.com/JesperIRL/jdk.git
>> $ cd jdk
>> $ git remote set-url origin --push git at github.com:JesperIRL/jdk.git
>> $ git remote add upstream https://github.com/openjdk/jdk.git
>> 
>> 
>> If you prefer not to introduce the complexity of separate fetch and push URLs for `origin`, I at least would like to see an `https` URL for the upstream.
>
> How do we motivate recommending https for upstream? I mean it's not as if people can push regardless. Is there a git convention to use https for read only repos?

GitHub defaults to https when you click on the green "Code" button to get the URL of a repo to clone. The Skara tooling also uses https URLs for openjdk/jdk in its examples (e.g., the example of fetching a pull request locally for testing). It seems better to suggest anonymous https for remotes that you don't need to push to (such as the upstream openjdk/jdk).

For the user's personal fork it really doesn't matter, so maybe it's better to drop that part of my suggestion (it's simpler too). So perhaps this?


$ git clone git at github.com:JesperIRL/jdk.git
$ cd jdk
$ git remote add upstream https://github.com/openjdk/jdk.git

-------------

PR: https://git.openjdk.java.net/guide/pull/59


More information about the guide-dev mailing list