brianjking

Active Member
Sep 15, 2009
35
1
58
Chicago, IL
cPanel Access Level
Root Administrator
Twitter
Hello,

I have a WHM/cPanel server running 11.48.4 (build 2) on CentOS 6.6 and have installed Git using the instructions provided in the cPanel/WHM documentation at https://documentation.cpanel.net/display/1148Docs/Git.


Code:
[[email protected] ~]# git --version
git version 1.7.1
However, there is not any instruction on how to upgrade git to a new version.

Please help!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

You can actually uninstall the system version of git through YUM and simply utilize the version already included with cPanel:

Code:
-bash-3.2# /usr/local/cpanel/3rdparty/bin/git --version
git version 2.2.0
Note that you can't change the version that's included with cPanel. You have to manually install your own system version of git if you want to use a specific version.

Thank you.
 
  • Like
Reactions: brianjking

brianjking

Active Member
Sep 15, 2009
35
1
58
Chicago, IL
cPanel Access Level
Root Administrator
Twitter
Hello,

You can actually uninstall the system version of git through YUM and simply utilize the version already included with cPanel:

Code:
-bash-3.2# /usr/local/cpanel/3rdparty/bin/git --version
git version 2.2.0
Note that you can't change the version that's included with cPanel. You have to manually install your own system version of git if you want to use a specific version.

Thank you.
Thanks for the quick reply. I have two questions.

  1. To uninstall do I simply run
    Code:
    yum remove git
    ?
    • Once I remove the package I installed with Yum how do I set the PATH for git to work just by running
      Code:
      git
      as opposed to having to execute it from
      Code:
      /usr/local/cpanel/3rdparty/bin/git
 

madmanmachines

Well-Known Member
Nov 28, 2014
94
4
8
cPanel Access Level
Root Administrator
Hi,

Yes, you may run `yum remove git' to uninstall. You can run the following to create a symbolic link to the cPanel git
Code:
ln -s /usr/local/cpanel/3rdparty/bin/git /usr/bin/git
 
  • Like
Reactions: brianjking

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Yes, the previous post is accurate. Simply run "yum remove git" and setup the symbolic link to /usr/bin/git and /usr/local/bin/git.

Thank you.
 
  • Like
Reactions: brianjking

brianjking

Active Member
Sep 15, 2009
35
1
58
Chicago, IL
cPanel Access Level
Root Administrator
Twitter
Yes, the previous post is accurate. Simply run "yum remove git" and setup the symbolic link to /usr/bin/git and /usr/local/bin/git.

Thank you.
I've done this and now have an issue when I go to commit to an existing repo to my Bitbucket origin master. Any help?

Code:
[[email protected] /home/REDACTED/www]# git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master
 

madmanmachines

Well-Known Member
Nov 28, 2014
94
4
8
cPanel Access Level
Root Administrator
That doesn't really sound like an error technically, but a warning rather due to a change of defaults in versions; and certainly not specific to cPanel. From http://stackoverflow.com/questions/...set-its-implicit-value-is-changing-in-git-2-0
It's explained in great detail in the docs (search for push.default on the page), but I'll try to summarize:

  • matching means git push will push all your local branches to the ones with the same name on the remote. This makes it easy to accidentally push a branch you didn't intend to.

  • simple means git push will push only the current branch to the one that git pullwould pull from, and also checks that their names match. This is a more intuitive behavior, which is why the default is getting changed to this.
This setting only affects the behavior of your local client, and can be overridden by explicitly specifying which branches you want to push on the command line. Other clients can have different settings, it only affects what happens when you don't specify which branches you want to push