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).
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.
On a Windows computer with git (and possibly also GitHub Desktop)2:
- Clone the repo to your shared drive location.
- 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.
Here's a rough outline of what to do:
On a Windows computer with git (and possibly also GitHub Desktop)2:
- Clone the repo to your shared drive location.
- Add
fileMode = falseto the git config.- In the repo folder, edit the file at
.git/configto addfileMode = falseunder[core] - Or you can run
git config --add fileMode falsein PowerShell
- In the repo folder, edit the file at
Back on the RStudio Server:
- Mount network drives (if not already).
- See
R:\TalkR\2023_11_30 - R at DOHMH\mountdrives.shfor instructions.
- See
- 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>" - 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.
On the RStudio Server:
- Clone the repo to your home directory (or some sub-folder).
- Run
git config --add core.fileMode false - 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/
- Note that
- 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>" - 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
-
Some things on Linux don't translate to Windows. Specifically, "NTFS does not support Unix permissions". ↩
-
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