Skip to content
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

Document how to use GH in the ring with 2FA. #115

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions source/components/github.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
***********************
Using GitHub at NSLS-II
***********************

Two-factor authentication
-------------------------

We strongly recommend `securing your account with two-factor authentication <https://help.github.com/en/articles/securing-your-account-with-two-factor-authentication-2fa>`_.

For normal use from the campus network, the most convenient way to access
GitHub is using SSH. See `GitHub's SSH guide <https://help.github.com/en/articles/connecting-to-github-with-ssh>`_.
Your remotes will look like:

.. code-block:: bash


$ git remote -v
danielballan [email protected]:danielballan/bluesky (fetch)
danielballan [email protected]:danielballan/bluesky (push)
origin [email protected]:bluesky/bluesky (fetch)
origin [email protected]:bluesky/bluesky (push)

Note ``[email protected]:`` in place of where you might have
``https://github.com/``. You can update a remote using

.. code-block:: bash

$ git remote set-url <NAME> <NEW_URL>

For use inside the ring, connecting via SSH does not work. (Consult ITC to ask
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is intended?

Suggested change
For use inside the ring, connecting via SSH does not work. (Consult ITC to ask
For users inside the ring, connecting via SSH does not work. (Consult ITC to ask

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair question. I meant "use". Maybe it could be phrase more clearly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, don't put users inside the ring, it's not safe there 🤣.

Maybe we can better say "For use in the controls network ..."?

why.) Your best option is to use a personal access token, which you can do at
`github.com/settings/tokens <https://github.com/settings/tokens>`_ or by
following `GitHub's token guide <https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line>`_.
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
``[email protected]:``). When you try to push you will be prompted to
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
your ssh config set up correctly):

.. code-block:: bash

git remote add <NAME> git+ssh://<BL_MACHINE_NAME>/<PATH_TO_REPO>

which will allow you to pull from the beamline machine to your machine
and then push back out to GitHub.
1 change: 1 addition & 0 deletions source/deployment_docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Components

.. toctree::

components/github
components/conda
components/ansible-setup

Expand Down