Skip to content

`lex gitlab` "Mirror"

Rick Pernak edited this page Apr 25, 2022 · 10 revisions

Mirror Initialization

For internal development, we wanted a private repository. GitHub doesn't allow accessibility levels to change between branches or forks, so to have something completely private, I've mirrored this repository as of commit 96bd498d881f32b5c64d50c65d5cc13ef21c854f to AER's internal Gitlab server lex-gitlab with:

% pwd
/rd47/scratch/RC/LBLRTM
% git remote -v
origin	[email protected]:AER-RC/LBLRTM.git (fetch)
origin	[email protected]:AER-RC/LBLRTM.git (push)
% git remote add mirror [email protected]:RC/lblrtm.git
% git push -u mirror --all
% git push -u mirror --tags

note: i have not used the Gitlab-recommended (and much simpler) web interface to mirror. i was not successful with that initially.

Branches vs. Tags

Branches and Tags should not be named identically (e.g., a v12.12 tag and branch cannot co-exist). Please use branches for development and tags for releases. Naming conventions should be v*.* for tags (major.minor), and branches are more free-form (e.g., pernak_v12.13_dev).

Since developers cannot push branches to master, they need not concern themselves with tags. Maintainers are responsible for releases.

Development in Mirror

Since LBLRTM has submodules associated with it, and those submodules are publicly available in GitHub, and .gitmodules does not specify a URL (I had to do this to allow SSH and HTTPS cloning), the submodule update is a little clunky. It requires a clone of each submodule after cloning the entire repository:

git clone [email protected]:RC/lblrtm.git lblrtm-mirror # NO RECURSIVE KEYWORD
cd lblrtm-mirror
rmdir aer_rt_utils cross-sections
git clone [email protected]:AER-RC/aer_rt_utils.git
git clone [email protected]:AER-RC/cross-sections.git
git checkout v12.11

note: the --recursive keyword is not used here. it can be, but the clone will return an error after checking out the core LBL code.

also note we are NOT working with the master branch. users should checkout the the latest version of LBL as of this writing, which is v12.11

then for developing:

git branch your_branch
git checkout your_branch
... # develop
git commit -a -m 'initial commit to my branch'
git push -u origin master

Then create a merge request. Maintainers of the repository take it from here.

Merging With GitHub (Maintainers Only)

The merge request created in the previous section will likely not be a merge of the development branch onto the master branch of the mirror. Rather, the branch probably should be pushed to the GitHub original.

First, we should ensure clarity between the private (lex-gitlab) and public (GitHub) repositories, which I will refer to as the remote mirror and remote origin, respectively:

% pwd

/rd47/scratch/RC/lblrtm-mirror

% git remote -v

origin [email protected]:RC/lblrtm.git (fetch)

origin [email protected]:RC/lblrtm.git (push)

% git remote rename origin mirror

% git remote add origin [email protected]:AER-RC/LBLRTM.git

Now a test branch to verify this works:

git checkout v12.11
git branch rp_test
git checkout rp_test
touch test.txt
git add test.txt 
git commit -a -m 'test merge between mirror and original'
git push mirror rp_test
git push origin rp_test

Note we can push the branch to both remotes (Gitlab and GitHub), so similar procedures can be followed for branches developed in Development in Mirror

Clone this wiki locally