-1

I'm trying to install Git with apt-get:

$ apt-get install git-core

I get this error:

E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

I'm pretty sure that my account is the root, but I tried doing this anyway:

$ su -

After which I get a response:

su: must be run from a terminal

Also, running sudo tells me the program isn't installed. I also can't install it because of the above error (must be run from a terminal).

How can I fix this problem?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tool
  • 12,126
  • 15
  • 70
  • 120
  • 2
    it appears your problem is mainly that you are not root, and you are not on a terminal. How are you connecting to the server/box/whatever ? – AntonioD Jul 18 '12 at 20:56
  • With SSH version 2. I'm using a software similar to Putty. – Tool Jul 18 '12 at 21:03
  • Is the machine from your hosting provider or do you (your company) own it? Are you even supposed to have root privileges? – Justin Ethier Jul 18 '12 at 21:22
  • I've sent a ticket about this. Awaiting response. It's a hosting provider. – Tool Jul 18 '12 at 21:33

2 Answers2

4

Try this:

$ sudo apt-get install git-core
Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
1

If you have a working C compiler on some computer, have experience with compilation (make configure && configure && make all && make install) and have perl and curl/openssl development files (headers and libraries), you can compile Git yourself and configure it to be installed in your home directory on that system. It is very easy and was actually a recommended installation routine in early days of Git development (the Makefile still has $HOME as default installation directory).

After installation you can collect the files and copy it to your remote system.

You can always find snapshots (.tar.gz) of current release/stable branch on kernel.org. Just unpack it somewhere and run the commands above. If you need offline documentation (manpages or html files), you'll need asciidoc installed on the development machine.

fork0
  • 3,401
  • 23
  • 23
  • configure never works. It used to with older versions. All you need now is the make script. Run once to compile, then again to install. – Adam Dymitruk Jul 18 '12 at 22:29
  • @AdamDymitruk: you're wrong. While seldom needed, it does work. – fork0 Jul 19 '12 at 07:19
  • I must be doing something wrong then. Every time I checkout a tag in the git repo, the configure file is missing. – Adam Dymitruk Jul 20 '12 at 06:47
  • Ah, I see. I failed to mention this: `make configure`. It is on the first page in the file INSTALL. Answer updated. – fork0 Jul 20 '12 at 07:50
  • @AdamDymitruk: Apologies, indeed. I seldom use the routine: all my machines are a very standard Debian, which compile out of the box. – fork0 Jul 20 '12 at 07:58