Skip to content

Commit f858db5

Browse files
author
Matthias Koeppe
committed
src/doc/en/developer/github.rst: Show git instructions using inline tabs for HTTPS/SSH
1 parent 83bc7da commit f858db5

File tree

1 file changed

+60
-14
lines changed

1 file changed

+60
-14
lines changed

src/doc/en/developer/github.rst

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ https://github.com/alice/sage.
123123

124124
Next if you don't have a local Git repo of Sage, then start afresh `cloning
125125
your fork
126-
<https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository>`_::
126+
<https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository>`_:
127+
128+
.. tab:: Using HTTPS
129+
130+
::
127131

128132
[alice@localhost ~]$ git clone https://github.com/alice/sage.git
129133
Cloning into 'sage'...
@@ -139,7 +143,30 @@ your fork
139143
origin https://github.com/alice/sage.git (fetch)
140144
origin https://github.com/alice/sage.git (push)
141145

142-
If you already have a local Git repo and only want to link your fork as ``origin`` remote, then do::
146+
.. tab:: By SSH protocol
147+
148+
::
149+
150+
[alice@localhost ~]$ git clone [email protected]:alice/sage.git
151+
Cloning into 'sage'...
152+
remote: Enumerating objects: 914565, done.
153+
remote: Counting objects: 100% (2738/2738), done.
154+
remote: Compressing objects: 100% (855/855), done.
155+
remote: Total 914565 (delta 1950), reused 2493 (delta 1875), pack-reused 911827
156+
Receiving objects: 100% (914565/914565), 331.09 MiB | 11.22 MiB/s, done.
157+
Resolving deltas: 100% (725438/725438), done.
158+
Updating files: 100% (9936/9936), done.
159+
[alice@localhost ~]$ cd sage
160+
[alice@localhost sage]$ git remote -v
161+
origin [email protected]:alice/sage.git (fetch)
162+
origin [email protected]:alice/sage.git (push)
163+
164+
165+
If you already have a local Git repo and only want to link your fork as ``origin`` remote, then do:
166+
167+
.. tab:: Using HTTPS
168+
169+
::
143170

144171
[alice@localhost sage]$ git remote add origin https://github.com/alice/sage.git
145172
[alice@localhost sage]$ git remote -v
@@ -155,7 +182,29 @@ If you already have a local Git repo and only want to link your fork as ``origin
155182
From https://github.com/alice/sage
156183
* [new branch] develop -> origin/develop
157184

158-
You also add the Sage repo ``sagemath/sage`` as your remote ``upstream``::
185+
.. tab:: By SSH protocol
186+
187+
::
188+
189+
[alice@localhost sage]$ git remote add origin [email protected]:alice/sage.git
190+
[alice@localhost sage]$ git remote -v
191+
origin [email protected]:alice/sage.git (fetch)
192+
origin [email protected]:alice/sage.git (push)
193+
[alice@localhost sage]$ git fetch origin
194+
remote: Enumerating objects: 1136, done.
195+
remote: Counting objects: 100% (1084/1084), done.
196+
remote: Compressing objects: 100% (308/308), done.
197+
remote: Total 1136 (delta 825), reused 982 (delta 776), pack-reused 52
198+
Receiving objects: 100% (1136/1136), 2.62 MiB | 5.30 MiB/s, done.
199+
Resolving deltas: 100% (838/838), completed with 145 local objects.
200+
From [email protected]:alice/sage
201+
* [new branch] develop -> origin/develop
202+
203+
You also add the Sage repo ``sagemath/sage`` as your remote ``upstream``:
204+
205+
.. tab:: Using HTTPS
206+
207+
::
159208

160209
[alice@localhost sage]$ git remote add upstream https://github.com/sagemath/sage.git
161210
[alice@localhost sage]$ git remote -v
@@ -164,19 +213,16 @@ You also add the Sage repo ``sagemath/sage`` as your remote ``upstream``::
164213
upstream https://github.com/sagemath/sage.git (fetch)
165214
upstream https://github.com/sagemath/sage.git (push)
166215

216+
.. tab:: By SSH protocol
167217

168-
.. NOTE::
169-
170-
If you linked your Git to GitHub by SSH protocol, then do the following
171-
instead to set up remotes::
218+
::
172219

173-
[alice@localhost sage]$ git remote add origin [email protected]:alice/sage.git
174-
[alice@localhost sage]$ git remote add upstream [email protected]:sagemath/sage.git
175-
[alice@localhost sage]$ git remote -v
176-
origin [email protected]:alice/sage.git (fetch)
177-
origin [email protected]:alice/sage.git (push)
178-
upstream [email protected]:sagemath/sage.git (fetch)
179-
upstream [email protected]:sagemath/sage.git (push)
220+
[alice@localhost sage]$ git remote add upstream [email protected]:sagemath/sage.git
221+
[alice@localhost sage]$ git remote -v
222+
origin [email protected]:alice/sage.git (fetch)
223+
origin [email protected]:alice/sage.git (push)
224+
upstream [email protected]:sagemath/sage.git (fetch)
225+
upstream [email protected]:sagemath/sage.git (push)
180226

181227
To prevent accidental pushes to ``upstream`` (instead of ``origin``), you may want to disable it by running::
182228

0 commit comments

Comments
 (0)