---
# System prepended metadata

title: Configure Git/Set up SSH

---

# Configure Git/Set up SSH

## Background

I created a new session on the dev server in the following location: 

```bash=
/export/home/ma904058
```

## SSH keygen

These steps are from WI-240089 (Application and Program Development on the R Platform)

## 1.6. Configure your local git settings by running in the RStudio Server IDE Terminal:

```bash=
git config --global user.name "<Developer Name>"
git config --global user.email "<Developer BioMarin Email Address>"
git config --global log.abbrevcommit yes
git config --global log.date rfc2822
```

```bash=
git config --global user.name "Martin Frigaard"
git config --global user.email "Martin.Frigaard@brmn.com"
git config --global log.abbrevcommit yes
git config --global log.date rfc2822
```

```bash=
[ma904058@BMNSA54A ~]$ cat .gitconfig 
[user]
        name = Martin Frigaard
        email = Martin.Frigaard@brmn.com
[log]
        abbrevcommit = yes
        date = rfc2822
```


### 1.7. Create an SSH Key by running: “ssh-keygen” using all the default values.

```bash=
[ma904058@BMNSA54A ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/ma904058/.ssh/id_rsa): 
/export/home/ma904058/.ssh/id_rsa already exists.
Overwrite (y/n)? y 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /export/home/ma904058/.ssh/id_rsa.
Your public key has been saved in /export/home/ma904058/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:F1hPWy2V5kPPSwIP54HQb2r9PIo6wmeQMSNI1Qc6XWE ma904058@BMNSA54A
The key's randomart image is:
+---[RSA 2048]----+
|    .....E= o .oo|
|   .  o.o+ B =.+.|
|  . .o .o . X =o.|
|   . ..+   . * +o|
|      . S . + o o|
|       o . o . . |
|      . . .   o  |
|       o +  .  + |
|        +.o. .. .|
+----[SHA256]-----+ 
```

### 1.8 Print the contents of the public SSH key by running the following command in the RStudio server IDE terminal:

```bash=
cat $HOME/.ssh/id_rsa.pub
cat: /export/home/ma904058/.ssh/id_rsa.pu: No such file or directory
```

Minor deviation here, because I set mine up in `/export/home/ma904058/Users/martin-frigaard/dashboards/proc-compare`. I also noticed the .gitconfig file and .id_rsa.pub are in the home (`~`) directory--will this interfere with other users (i.e. Freddy?)?

```bash=
[ma904058@BMNSA54A ~]$ ls -la
total 32
drwx------ 11 ma904058 cdmcp  255 Dec  6 10:17 .
drwxr-xr-x 28 root     root  4096 Oct 20 10:21 ..
-rw-------  1 ma904058 cdmcp  710 Apr  6  2021 .bash_history
-rw-r--r--  1 ma904058 cdmcp   18 Mar 19  2021 .bash_logout
-rw-r--r--  1 ma904058 cdmcp  193 Mar 19  2021 .bash_profile
-rw-r--r--  1 ma904058 cdmcp  231 Mar 19  2021 .bashrc
drwxr-xr-x  3 ma904058 cdmcp   18 Mar 19  2021 .cache
drwxr-xr-x  5 ma904058 cdmcp   42 Dec  6 09:02 .config
-rw-rw-r--  1 ma904058 cdmcp  107 Dec  6 10:06 .gitconfig
-rw-------  1 ma904058 cdmcp   18 Mar 19  2021 .k5login
drwxr-xr-x  3 ma904058 cdmcp   19 Dec  6 09:02 .local
drwxr-xr-x  4 ma904058 cdmcp   39 Mar 19  2021 .mozilla
drwxrw----  3 ma904058 cdmcp   19 Apr  2  2021 .pki
drwxrwxr-x  3 ma904058 cdmcp   45 Mar 19  2021 R
-rw-rw-r--  1 ma904058 cdmcp   60 Dec  6 09:18 .Rhistory
drwxrwxr-x  3 ma904058 cdmcp   28 Dec  6 09:02 .rstudio
drwx------  2 ma904058 cdmcp   38 Dec  6 10:17 .ssh
drwxrwxr-x  4 ma904058 cdmcp   50 Apr  2  2021 Users
[ma904058@BMNSA54A ~]$ cat .gitconfig 
[user]
        name = Martin Frigaard
        email = Martin.Frigaard@brmn.com
[log]
        abbrevcommit = yes
        date = rfc2822
[ma904058@BMNSA54A ~]$ cd .ssh
[ma904058@BMNSA54A .ssh]$ ls
id_rsa  id_rsa.pub
```


### 1.9. Copy the contents to the clipboard by selecting the output, right clicking, and selecting "Copy".

```bash=
ssh-rsa AAAAB3NzaC1.... ma904058@BMNSA54A
```

### 1.10. Navigate to https://git.bmrn.com/profile/keys in a new web browser tab.


### 1.11. Paste the clipboard contents into the “Key” field by right-clicking in it, and selection “Paste”. Ensure the title is unique within the list on the page, if not assign a unique name.

I named this key: `ma904058@BMNSA54A - dev server`

1.12. Press “add key” to add the public key to your GitLab account.

I received the following email: 

> Hi Martin Frigaard! 
> A new public key was added to your account: 
> title: ma904058@BMNSA54A - dev server 


### 1.13. Return to the RStudio Server IDE.


### 1.14. Open the tools menu and navigate to the Global Settings dialog.

Minor change here (it's the "Global Options" dialog)


### 1.15. Select “Publishing” and verify that an entry is present for the URL of the current environment. If so, proceed to section 3, otherwise continue.

No entries are visible in this dialog:


### 1.16. Click the connect button and enter the URL of the current environment, proceed with the login to RStudio Connect as prompted. If user already have “publisher” permission, proceed to step 1.20, otherwise continue.

Before connecting I was prompted to update the following packages: curl, openssl, rstudioapi, packrat, and rsconnect.



## 1.17. If user needs the permission to publish, please contact RStudio Connect Software Administrator by email.

#### 1.18. Once RStudio connect software administrator received the request.


#### 1.18.1. Verify the user permission if user is allowed to be a publisher.


#### 1.18.2. RStudio connect software administrator login to RStudio Connect, go to "people".
Select the user and click edit.
1.18.3. Change the user role to “Publisher” and click save (Enter the administrator password if
system asked).
1.18.4. Inform user that permission is granted.
1.19. User received the permission granted email, back to RStudio IDE and follow the step 1.20 to
1.22.

---

https://happygitwithr.com/ssh-keys.html
