1

I am trying to get my IDE set up at work for a project I am working on. I am coding in python and working in PyCharm because of its awesome git support. However, whenever I try to configure git on PyCharm to clone my project, it tells me that my version of git , 1.7.1.0, is too old and needs to be updated to at least 1.7.1.1. I have searched around dozens of times and have only ever found solutions that require root access to achieve. Is there any simple way to update git on this machine?

2

Compile it and then install it locally. - Step-by-step:

  1. go to https://github.com/git/git and download the zip file. Extract it to a convenient place and cd into it.

If you are fine with git installing to ~/bin, you can skip 2 and 3 (source)

  1. run make configure
  2. run ./configure --prefix=/some/absolut/path/to/your/private/bin where the path can be eg.: /home/YOUR_USERNAME/.local - make sure the directory exists!
  3. run make && make install
  4. prefix ~/.bin to your $PATH environment variable, ie.: export PATH="~/.local:$PATH" or export PATH="~/bin:$PATH" in case you did not use configure to change the defaults.
  5. you should now be able to run 'git'.

Optional:

Add the export PATH="~/YOURFOLDER:$PATH" statement to your ~/.profile (if not existant, create it and paste the line into it) so PATH is set each time you login.

More on this in the INSTALL file in the downloaded git source.

  • Thank you very much, I understand. The only issue now is that I get an error on make install, saying: cannot change permissions of /usr/local/libexec/git-core: No such file or directory. I'll figure it out. – JHollowed Jul 27 '15 at 17:32
  • 1
    @JHollowed weird. What have you set in --prefix= ? Actually, I just read that you can leave out step 2 and 3. Then git will be installed to ~/bin (and not to the ~/.bin I used in my example). – larkey Jul 27 '15 at 17:53
  • @JHollowed Also make sure to flag the question as answered ;-) – larkey Jul 27 '15 at 17:54
  • 1
    @ssnobody No, by default git will install to ~/bin if no prefix is set. – larkey Jul 28 '15 at 9:04
  • 1
    @ssnobody No offense taken, I should have more precisely mentioned where I took this from. It's from the INSTALL file in the root of the sources, 5l. I will add that to the anwer. -- Regarding the 'make configure --help': Well that's weird, as when you run make install without root it can't install to /usr/local/bin ^^ (and it stands in clear contraditction with the INSTALL file) – larkey Jul 29 '15 at 8:34
0

Assuming you have the necessary C development tools installed, you can compile your own version of git from sources, and install it in $HOME/bin/ then ensure that's at the front of your PATH (assuming PyCharm just looks for git in your PATH).

  • But how can I compile from source if I cannot use sudo? – JHollowed Jul 27 '15 at 16:34
  • @JHollowed You do not need root to compile - root is only needed for access to system stuff - anything in HOME is ok. Some programs might want root on compilaton though, so you need to setup a "fakeroot" environment. Otherwise just compile it and use it locally. – larkey Jul 27 '15 at 16:39
  • @larkey Then how should I do that? I cannot use sudo at all, and if I try yum install git, it denies me access and says the incident will be reported. I would be fine to compile and use it locally on this machine. Where should I look for instruction? – JHollowed Jul 27 '15 at 16:58
  • @JHollowed We did tell you to COMPILE IT LOCALLY. This means: Download the sourcecode of git from the website and then build it locally (see the documentation on how to do that). – larkey Jul 27 '15 at 16:59
  • 1
    @larkey Well I have never used linux until last week, and this is my first professional programming experience, so bare with me. You mean to clone this repository: github.com/git/git, correct? From there I would not be sure what to do. I have read the INSTALL file, but it clearly assumes prior knowledge. Surely I cant just type make, make install into the terminal and it will work. Where are those commands supposed to be carried out? I have never compiled code before. – JHollowed Jul 27 '15 at 17:09
0

This is still relevant, so based on my recent experience, I wanted to add some additional information to @larkey 's response above:

  1. If the make && make install fails, run yum install zlib-devel (or whatever your *nix distro uses to get the zlib packages installed)

  2. Once the make install completed, CentOS7 was still saying that 1.8.3 was the current version of git. I just moved the current git out of the way and created a symbolic link to the newly installed version:

    cd /usr/bin
    
    sudo mv git git_1.8.3.1
    
    sudo ln -s /home/<user name>/.local/bin/git git
    

Not the most elegant solution, but it worked and I could move on to more pressing issues. I suppose I could have used the alternatives install to fix this, but whatevs.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.