-
Notifications
You must be signed in to change notification settings - Fork 0
Git and Github
One Time SSH Set Up
How Many SSH Keys
You need to add an ssh key to Github for use in validation. If you work on various machines, one option is to have the same key on all of them. In that case, you need to copy the private and public versions of that key to all other machines you want to work with. The downside of this approach is that you’ll need to do this copy again to all machines, if any one of those machines are lost or stolen. A paranoid sysadmin would probably delete all of them anyway, even if you use different keys on different machines, not trusting you kept straight which key belongs to which machine. In any case, you should create a separate key for Github only, because if this key is compromised you don’t want to have to replace it everywhere else you might use it.
- On your primary dev machine (likely a Mac) generate an
ssh key
. The sample below generates a key namedid_rsa
. If you already have one with that name, add the optional flag and output-filename: ssh-keygen -b 2048 [-f .ssh/ - Copy the public and private version of that key to all other dev machines. If you do copy and paste in Windows, do it in a
VS Code
window and save from there. Doing it in a terminal will cause funky problems and the key won’t be recognized byssh
. - Cat the
.pub
public key file and copy the text. - Go to the Github user settings and select SSH and GPG keys. Click on New SSH Key and paste in the public key you copied above. Then save.
- In the Git Bash shell run the command
ssh -vT git@github.com
. This is necessary so so that you canssh
to Github properly moving forward. Say yes to add Github to your known hosts.
Post Installation Configuration
- After installing the
git
client on your machine, run the following commands to configure git:git config --global user.email "<company github email>" git config --global user.name "<github-username>" git config -l # check git configuration is set up properly with email and username
Installing GitHub Desktop
- Download and install Github Desktop from here.
- Log in with your user credentials.
- On Windows, set the console to be
ConsoleZ
and adjust its settings according to the instructions here.
Setting Up Git for Visual Studio Code
- First install Visual Studio Code and all its extensions as described here. Go to Configure Settings and find the "git.path" setting. Add the following definition:
{ "git.path": "C:\\Program Files\\Git\\bin" # on Windows "git.path": "/usr/local/bin/git" # on Mac OS X -- this is the brew version }
- For the first installation of VS Code, go to Github & choose Settings. Then choose Personal Access Tokens. Create a new token for VS Code and give it all permissions and click Generate Token. Make sure to copy the token and store it in 1Password. If you have already created it, copy it from 1Password.
- In VS Code, install the Visual Studio Github Support extension. Then from the menu choose View → Command Palette and then choose the command Github: Set Personal Access Token. Paste in the token you copied in previous step.
- You will also need this token to set up the VS Sync Settings extension.
Setting Up Github for Visual Studio
** Setting up Github for **
Link | Description |
---|---|
Mastering Markdown | Mastering Markdown Guide |
Git Credential Manager for Windows | Git Credential Manager for Windows Github and Doco |
Visual Studio Code Github Support | Visual Studio Code Github Support Description in VS Marketplace |
RStudio and Github | Rstudio and Github Guide |