From 50e09be12929cd8a6f07a8bd5f1ddc918f0196d4 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Fri, 5 Jul 2019 15:12:59 -0400 Subject: [PATCH 1/6] Document how to use GH in the ring with 2FA. --- source/components/github.rst | 41 ++++++++++++++++++++++++++++++++++++ source/deployment_docs.rst | 1 + 2 files changed, 42 insertions(+) create mode 100644 source/components/github.rst diff --git a/source/components/github.rst b/source/components/github.rst new file mode 100644 index 0000000..50afdb8 --- /dev/null +++ b/source/components/github.rst @@ -0,0 +1,41 @@ +*********************** +Using GitHub at NSLS-II +*********************** + +Two-factor authentication +------------------------- + +We strongly recommend `securing your account with two-factor authentication `_. + +For normal use from the campus network, the most convenient way to access +GitHub is using SSH. See `GitHub's SSH guide `_. +Your remotes will look like: + +.. code-block:: bash + + + $ git remote -v + danielballan git@github.com:danielballan/bluesky (fetch) + danielballan git@github.com:danielballan/bluesky (push) + origin git@github.com:bluesky/bluesky (fetch) + origin git@github.com:bluesky/bluesky (push) + +Note ``git@github.com:`` in place of where you might have +``https://github.com/``. You can update a remote using + +.. code-block:: bash + + $ git remote set-url + +For use inside the ring, connecting via SSH does not work. (Consult ITC to ask +why.) Your best option is to a personal access token, which you can do at +`github.com/settings/tokens `_ or by +following `GitHub's token guide `_. +You can then paste the token into a file in your home directory. Make sure +to restrict the permissions with ``chmod 600 path/to/file_with_token`` or any +user will be able to read it and log into GitHub as you! + +To *use* the token, set the remote urls in the HTTPS style +(not ``git@github.com:``). When you try to push you will be prompted to enter +your username. Paste the token it instead. GitHub will recognize your username +automatically from the token. diff --git a/source/deployment_docs.rst b/source/deployment_docs.rst index a1a12a4..5d32987 100644 --- a/source/deployment_docs.rst +++ b/source/deployment_docs.rst @@ -11,6 +11,7 @@ Components .. toctree:: + components/github components/conda components/ansible-setup From 46adb939722cb18907cd606015f781027ca53849 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Fri, 5 Jul 2019 15:35:47 -0400 Subject: [PATCH 2/6] Apply suggestions from code review Revisions from @mrakitin Co-Authored-By: Maksim Rakitin --- source/components/github.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/components/github.rst b/source/components/github.rst index 50afdb8..72d8ca4 100644 --- a/source/components/github.rst +++ b/source/components/github.rst @@ -28,7 +28,7 @@ Note ``git@github.com:`` in place of where you might have $ git remote set-url For use inside the ring, connecting via SSH does not work. (Consult ITC to ask -why.) Your best option is to a personal access token, which you can do at +why.) Your best option is to use a personal access token, which you can do at `github.com/settings/tokens `_ or by following `GitHub's token guide `_. You can then paste the token into a file in your home directory. Make sure @@ -38,4 +38,3 @@ user will be able to read it and log into GitHub as you! To *use* the token, set the remote urls in the HTTPS style (not ``git@github.com:``). When you try to push you will be prompted to enter your username. Paste the token it instead. GitHub will recognize your username -automatically from the token. From 4bcc5e416726265f036a8effe37876ca2b17e8bb Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 5 Jul 2019 15:45:51 -0400 Subject: [PATCH 3/6] DOC: apply the rest of mrakitin's comments --- source/components/github.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/components/github.rst b/source/components/github.rst index 72d8ca4..63d82ad 100644 --- a/source/components/github.rst +++ b/source/components/github.rst @@ -35,6 +35,8 @@ You can then paste the token into a file in your home directory. Make sure to restrict the permissions with ``chmod 600 path/to/file_with_token`` or any user will be able to read it and log into GitHub as you! -To *use* the token, set the remote urls in the HTTPS style -(not ``git@github.com:``). When you try to push you will be prompted to enter -your username. Paste the token it instead. GitHub will recognize your username +To *use* the token, set the remote urls in the HTTPS style (not +``git@github.com:``). When you try to push you will be prompted to +enter your username. AFter entreing the username, you will be prompted +to enter your password. Paste the token in instead. + From 343f6ed07fbe299d7b41d3c9be05d159cfd3eb39 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 5 Jul 2019 15:46:04 -0400 Subject: [PATCH 4/6] DOC: add note about adding BL machine as a remote on your machine --- source/components/github.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/components/github.rst b/source/components/github.rst index 63d82ad..dc78038 100644 --- a/source/components/github.rst +++ b/source/components/github.rst @@ -40,3 +40,12 @@ To *use* the token, set the remote urls in the HTTPS style (not enter your username. AFter entreing the username, you will be prompted to enter your password. Paste the token in instead. +You can also add the beamline workstation as remote on your machine (assuming you have +your ssh config set up correctly): + +.. code-block:: bash + + git remote add git+ssh:/// + +which will allow you to pull from the beamline machine to your machine +and then push back out to github. From dcae9bf40f38e67539383360d9546c0713fea4fd Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Mon, 8 Jul 2019 09:31:46 -0400 Subject: [PATCH 5/6] Fix typo Co-Authored-By: Leo Fang --- source/components/github.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/components/github.rst b/source/components/github.rst index dc78038..cca3e28 100644 --- a/source/components/github.rst +++ b/source/components/github.rst @@ -37,7 +37,7 @@ user will be able to read it and log into GitHub as you! To *use* the token, set the remote urls in the HTTPS style (not ``git@github.com:``). When you try to push you will be prompted to -enter your username. AFter entreing the username, you will be prompted +enter your username. After entering the username, you will be prompted to enter your password. Paste the token in instead. You can also add the beamline workstation as remote on your machine (assuming you have From 65bfb98eb98c6e3f0c362ff056a6a55039c2c7bd Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Mon, 8 Jul 2019 09:32:03 -0400 Subject: [PATCH 6/6] Fix capitalization. Co-Authored-By: Maksim Rakitin --- source/components/github.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/components/github.rst b/source/components/github.rst index cca3e28..d8298f4 100644 --- a/source/components/github.rst +++ b/source/components/github.rst @@ -48,4 +48,4 @@ your ssh config set up correctly): git remote add git+ssh:/// which will allow you to pull from the beamline machine to your machine -and then push back out to github. +and then push back out to GitHub.