I was about to play around on my virtual machine running Ubuntu 12.04. I installed GIT-CORE using apt-get install git-core from repos. First I thought the apt-get command will install in the folder I am in, but I was wrong. So is there a way to directly tell apt-get where to install ?

Or do I have to move the files later? Let me know your best solution for this.

  • The apt-get command will install to the system - in /usr/share etc. There is a question here which you may find helpful.
    – Wilf
    Jan 13, 2014 at 13:15
  • great, i didn't find that topic.
    – Private
    Jan 13, 2014 at 13:21

1 Answer 1


I don't know if I understood the problem correctly, so the answer goes in two directions. The first: apt-get, deb packages, and source packages. The second: Git.

The first thing to say is that apt-get install does not choose where to install a package, but the package itself specifies that information. A .deb file is just a set of compressed directories which, in fact, has the proper install targets within. So, in short, no you can't change the apt-get install destination of the packages, because it has to do with the packages, not with apt-get. Last on this, each location within a deb goes to the particular GNU/Linux directory in your system, so /usr/share/bin cannot be changed by other, the same for the "man" pages, icons, etc. Once you touch the deb, it is actually a very tricky thing to handle.

Second, of course you can work-around the paths if you know what you are doing. It is not a simple task to do for beginners or intermediate users since you need to handle the deb packaging rules to modify the deb package. To do that, just download the package without installing it with apt-get, uncompress the package and edit the deb manifest and the files/directories you may want to change. Again, this is not encouraged at all and there is no reason to do this unless you are a developer that wants to test something in particular with that package.

Third, you can always compile from the source. That will basically make a "portable" version of the software you want to install and will locate it on your home folder. Of course, it will carry a) lots of dev dependencies to build the source b) eventually solve different problems regarding the compilation. This is also not recommended for beginners, unless there is no other way to install that particular software (which clearly is not the case of Git).

But, probably you might just want to change the git location target folders? To do that you just need to configure your git account and the folders to sync. That process though has nothing to do with apt-get. Check some guides on how to do it here or here. Of course, you can always see the official page or the man page of git (man git in a shell).

  • Is there a place to download git compiled binaries and just extract them? No installation, just a copy of the binaries.
    – Royi
    Jul 27, 2017 at 21:33
  • Hey @Royi, I don't think there is "a centralized place" where to download just binaries. Probably the most similar thing to that is the Electron Repository (electron.atom.io/apps) but it hostes fully working programs not just the binaries. Since the binaries are usually linked to libraries in order to work, only super simple programs can be run just by their binaries. With that said, I', pretty sure that if you surf enough you will find some binaries to download, although it is difficult to be accurate in the answer without knowing what you are looking for.
    – Rho
    Aug 3, 2017 at 12:29
  • I meant someplace where I can download Statically Compiled GIT binaries which doesn't require installation of many dependencies.
    – Royi
    Aug 3, 2017 at 16:08
  • Well... I don't think that exists in any operative system "in that way" since any application depends on external libraries (some libraries just come with your operative system so you don't need to get them from external sources)... of course, if it is a simple program you may avoid to download and compile more files. The possibility of having just one file depends on the complexity of the program you want. Again, the closest thing I know are Electron Apps (compiled as ".appimage"). I don't know (and I don't think that exists) any thing like a ".bin" repo on github or other hosting solution.
    – Rho
    Aug 3, 2017 at 22:42

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