Git: Difference between revisions

From VoIPmonitor.org
(Add troubleshooting section for git upgrade detached HEAD error)
Line 6: Line 6:
git config http.postBuffer 524288000
git config http.postBuffer 524288000


==self compiled sniffer from GIT sources==
==Self-compiled sniffer from Git sources==
If customer use self compiled sniffer from git, (napatech card card not supported in static binaries provided by voipmonitor.org) set in sniffer's /etc/voipmnitor.conf
If you use a self-compiled sniffer from Git (required for Napatech cards, which are not supported in static binaries provided by voipmonitor.org), configure the sniffer's <code>/etc/voipmonitor.conf</code> with:
upgrade_by_git = yes
git_folder = /usr/src/voipmonitor-git
The sniffer will perform (after click on UPGRADE in GUI) git pull,configure,make_clean,make, service voipmonitor stop, make install, service voipmonitor start


If you need some special parameters for configure you can add with configure_param option. E.g.
<syntaxhighlight lang="ini">
configure_param = --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
upgrade_by_git = yes
git_folder = /usr/src/voipmonitor-git
</syntaxhighlight>
 
When you click UPGRADE in the GUI, the sniffer will perform these steps:
<pre>
git pull
configure
make clean
make
service voipmonitor stop
make install
service voipmonitor start
</pre>
 
If you need special parameters for <code>configure</code> (e.g., for Napatech support), add them with the <code>configure_param</code> option:
<syntaxhighlight lang="ini">
configure_param = --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
</syntaxhighlight>
 
=== Troubleshooting Git Upgrade Issues ===
 
==== Error: "You are not currently on a branch" ===
 
If the git upgrade fails with the error <code>fatal: You are not currently on a branch.</code>, your Git repository is in a '''detached HEAD state'''. This typically happens if a specific commit hash or tag was previously checked out, or if a previous upgrade attempt was interrupted.
 
The <code>upgrade_by_git</code> mechanism relies on <code>git pull</code> to update the source code, which only works when you are actively tracking a branch (e.g., <code>master</code> or <code>develop</code>).
 
'''Solution:'''
 
1. Navigate to your Git source directory:
<syntaxhighlight lang="bash">
cd $(grep "^git_folder" /etc/voipmonitor.conf | awk '{print $2}')
# Or directly if you know the path:
cd /usr/src/voipmonitor-git
</syntaxhighlight>
 
2. Check the current Git status:
<syntaxhighlight lang="bash">
git status
</syntaxhighlight>
Expected output should show: <code>HEAD detached at <commit-hash></code>
 
3. Switch to the appropriate branch:
 
  For standard production (stable) installations:
<syntaxhighlight lang="bash">
git checkout master
</syntaxhighlight>
 
  For Napatech cards or development builds:
<syntaxhighlight lang="bash">
git checkout develop
</syntaxhighlight>
 
4. Update to the latest code:
<syntaxhighlight lang="bash">
git pull
</syntaxhighlight>
 
5. Verify you are on the correct branch:
<syntaxhighlight lang="bash">
git branch
</syntaxhighlight>
Expected output should show an asterisk (<code>*</code>) next to <code>master</code> or <code>develop</code>.
 
6. Retry the upgrade process from the GUI or command line.
 
'''Note:''' The Napatech documentation and official instructions refer to the branch as <code>develop</code> (NOT "development"). Use the exact branch name to avoid errors.

Revision as of 18:02, 5 January 2026

GIT upload

If you attempt to push a large set of changes to a Git repository with HTTP or HTTPS, you may get an error message such as error: RPC failed; result=22, HTTP code = 411. This is caused by a Git configuration default which limits certain HTTP operations to 1 megabyte. To change this limit run within your local repository

git config http.postBuffer *bytes*where bytes is the maximum number of bytes permitted. For exmaple:

git config http.postBuffer 524288000

Self-compiled sniffer from Git sources

If you use a self-compiled sniffer from Git (required for Napatech cards, which are not supported in static binaries provided by voipmonitor.org), configure the sniffer's /etc/voipmonitor.conf with:

upgrade_by_git = yes
git_folder = /usr/src/voipmonitor-git

When you click UPGRADE in the GUI, the sniffer will perform these steps:

git pull
configure
make clean
make
service voipmonitor stop
make install
service voipmonitor start

If you need special parameters for configure (e.g., for Napatech support), add them with the configure_param option:

configure_param = --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib

Troubleshooting Git Upgrade Issues

= Error: "You are not currently on a branch"

If the git upgrade fails with the error fatal: You are not currently on a branch., your Git repository is in a detached HEAD state. This typically happens if a specific commit hash or tag was previously checked out, or if a previous upgrade attempt was interrupted.

The upgrade_by_git mechanism relies on git pull to update the source code, which only works when you are actively tracking a branch (e.g., master or develop).

Solution:

1. Navigate to your Git source directory:

cd $(grep "^git_folder" /etc/voipmonitor.conf | awk '{print $2}')
# Or directly if you know the path:
cd /usr/src/voipmonitor-git

2. Check the current Git status:

git status

Expected output should show: HEAD detached at <commit-hash>

3. Switch to the appropriate branch:

  For standard production (stable) installations:
git checkout master
  For Napatech cards or development builds:
git checkout develop

4. Update to the latest code:

git pull

5. Verify you are on the correct branch:

git branch

Expected output should show an asterisk (*) next to master or develop.

6. Retry the upgrade process from the GUI or command line.

Note: The Napatech documentation and official instructions refer to the branch as develop (NOT "development"). Use the exact branch name to avoid errors.