Skip to content

nychealth/R-server-GitHub-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

R-server-GitHub-test

A repo for testing GitHub operations from the DOHMH RStudio server. Members of the "All Org Users" team have write access.

See R_server_GitHub_setup.R for brief instructions for setting up GitHub connections on the agency's RStudio server.

After cloning this repo, you can test committing and pushing by creating a new file (an empty text file is fine).

Some notes about repos on shared drives

IMHO, the default should be to work with local repos on the RStudio Server. That's the model that git/GitHub are really intended for: everyone has a local copy, and everyone syncs to GitHub. GitHub is the canonical location for everything, not the shared drive. Nobody is ever editing the same file as you. If you really need the repo to be on a shared drive...

Yes, you can do it! You just can't clone repos directly to shared drives through the RStudio Server, or set repo-level (aka local) configuration options, or anything else that calls chmod under the hood1.

Option 1: Clone on Windows and keep it local

On a Windows computer with git (and possibly also GitHub Desktop)2:

  1. Clone the repo to your shared drive location.
  2. Keep this local version up-to-date by fetching and pulling from GitHub.

That's it. Everyone else works in their own local version, and pushes their changes to GitHub. Nobody is ever editing the same file as you.

Option 2: Clone on Windows then link to RStudio Server

Here's a rough outline of what to do:

On a Windows computer with git (and possibly also GitHub Desktop)2:

  1. Clone the repo to your shared drive location.
  2. Add fileMode = false to the git config.
    • In the repo folder, edit the file at .git/config to add fileMode = false under [core]
    • Or you can run git config --add fileMode false in PowerShell

Back on the RStudio Server:

  1. Mount network drives (if not already).
    • See R:\TalkR\2023_11_30 - R at DOHMH\mountdrives.sh for instructions.
  2. Create a symbolic link (in your home directory, or wherever) to the shared drive location by running: ln -s "$HOME/networkDrives/smb-share:server=<YOUR_SERVER>,share=<SHARE_NAME>/<YOUR_REPO_PATH>" "$HOME/<YOUR_REPO_NAME>"
  3. Use the <YOUR_REPO_NAME> folder as your new git repo!

Note that you really only need 1 person with git on Windows to make this option work. It's just easier if everyone can do anything.

Also note: if more than 1 person is working in the repo at a time, you may get file locking problems.

Option 3: Clone on RStudio Server then copy to shared drive

On the RStudio Server:

  1. Clone the repo to your home directory (or some sub-folder).
  2. Run git config --add core.fileMode false
  3. Copy the repo to your shared drive location by running: cp -r "<SERVER_REPO_PATH>" "$HOME/networkDrives/smb-share:server=<YOUR_SERVER>,share=<SHARE_NAME>/<REPO_PARENT_FOLDER>"
    • Note that <REPO_PARENT_FOLDER> is the parent folder, aka the place where you want the repo folder to be. So if you want your repo to be at <FOLDER>/repos/<YOUR_REPO_NAME>, the second argument (the "DEST") will be <FOLDER>/repos/
  4. Create a symbolic link (in your home directory, or wherever) to the shared drive location by running: ln -s "$HOME/networkDrives/smb-share:server=<YOUR_SERVER>,share=<SHARE_NAME>/<YOUR_REPO_PATH>" "$HOME/<YOUR_REPO_NAME>"
  5. Use the <YOUR_REPO_NAME> folder as your new git repo!

Note: if more than 1 person is working in the repo at a time, you may get file locking problems.

Footnotes

  1. Some things on Linux don't translate to Windows. Specifically, "NTFS does not support Unix permissions".

  2. You'll need to submit tickets to get these installed. Go to BREAK / FIX, Desktop Software Installation and Uninstallation > 2 - User Desktop Software Issue and Installation/Uninstallation > Other on ServiceNow 2

About

A repo for testing GitHub operations from the DOHMH RStudio server

Resources

Stars

Watchers

Forks

Contributors

Languages