LibreNMS Git Workflow

Fork = A copy of the LibreNMS repository (repo).

We need to differentiate between the original LibreNMS and your fork of LibreNMS Git repo. All modifications and additions you make to LibreNMS will be sent to your Git repo. The Git commands on your server need to know which repo is the original and which repo is the fork. Unfortunately, the terminology used for Git repos is counter-intuitive. Your Git configuration doesn't have to set to 'Origin' and 'Upstream'. However, for the sake of clarity, and to conform to the Git docs, we will use these configuration settings.

Upstream = LibreNMS git repository.

Origin = Your fork of the LibreNMS git repository.

cd /opt

git clone https://github.com/<your-git-account>/librenms.git

Sample /opt/librenms/.git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/<your-git-account/librenms.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = librenms
    merge = refs/heads/master
[remote "upstream"]
    url = https://github.com/librenms/librenms.git
    fetch = +refs/heads/*:refs/remotes/upstream/*
git remote add upstream https://github.com/librenms/librenms.git

```bash cd /opt/librenms

git config branch.autosetupmerge true git config --global user.name "John Doe" git config --global user.email johndoe@example.com

Go to your git page and fork librenms, then tell git to add an origin, which is your RobsanInc fork of LibreNMS

git remote add origin https://github.com/RobsanInc/librenms.git

Show your remote gits

git remote -v

##Example output from 'git remote -v'

origin https://github.com/RobsanInc/librenms.git (fetch) origin https://github.com/RobsanInc/librenms.git (push) upstream https://github.com/librenms/librenms.git (fetch) upstream https://github.com/librenms/librenms.git (push)

Checkout and create '-b' a local branch

git checkout -b issue-1991

OR the above can be done in two steps

git branch issue-1991 git checkout issue-1991

Edit or create new files, then add these files to new branch

git add path/to/new/files/or/folders git commit -a -m 'Added feature to do X, Y and Z'

Push all of these files to origin (RobsanInc) git repo

git push origin --all

Then go to robsan github page and do a pull request for issue-1991

Clean-up after pull request has been accepted to librenms master

##Switch to local master, then delete local branch

git checkout master git branch -d issue-1991

##Delete remote origin (RobsanInc git) branch

git push origin --delete issue-1991

create an issue on github, or do it via the command line

Git reset local master to upstream (librenms git) and then push your recently reset master to the origin (robsan git)

git checkout master git reset --hard upstream/master git push origin master --force

GitHub Commands

git clone https://github.com/librenms/librenms.git

git status

git add index.html

git add -A

git commit -m "added new index.html"

git push