git_remote {git4r} | R Documentation |
Git Modify Remotes
Description
View and interactively edit remotes for this repo. The most important of these
is 'origin' which will be used by git_pull()
, however you may also want a
write-only mirror, for example where you push a production-ready commit. If
GIT_DEFAULT_REMOTE
environmental value has been set, this will be suggested
for 'origin'.
Usage
git_remote(remote_name = NULL, remote_path = NULL)
Arguments
remote_name |
Name of remote to add (such as 'origin') else leave NULL and answer interactively |
remote_path |
Path / URL of remote to add, empty string will use
|
Details
If using a filesystem path for the remote, you can only create a bare repository
as the remote as limited by git2r::push()
. A bare repository has the advantage
for 'origin' because no one should make any changes to this directly
(instead, clone their own copy).
If you have set GIT_DEFAULT_REMOTE
environmental value this will be suggested
as the path for creating an 'origin' remote. This will make life easier because
it will be the same as the rest of your projects / team and will be searched
by git_clone()
. Put this value in your user settings with
file.edit('~/.Renviron')
or as a one-off:
-
Sys.setenv(GIT_DEFAULT_REMOTE='P:/ath/to/teams/remote_repo/folder')
It is possible to use an on-premises 'origin' remote which in turn synchronises with another server. This 'hybrid' is best achieved by using fully-fledged git installation set up to synchronise as a scheduled task or somehow triggered. The shared-drive remote repo can be overwritten with:
-
git clone --mirror <url>
And then these commands run regularly will keep both in sync. If a branch gets divergent commits between cloud and shared-drive, the latter will take precedence. This has not been thoroughly tested and goes beyond the limitations of this package!
-
git push
-
git remote update --prune
Value
Invisible NULL