How to install Git on Ubuntu?

7,455

Prefix the command with sudo. This gives you Administrative permissions for one command (runs it as the root user). You will be prompted for your user password.

Run:

sudo apt-get install git

More information on sudo here

Note: You may also temporarily log in as root by typing sudo su

Install via the software center

UPDATE

Since the OP posted new information with a different error:

Only one instance of the package manager/updater can be running at one time. Make sure you have no other terminals trying to install software, or that your Software Updater isn't trying to install updates. Best way to make sure of this if you're not sure is to restart, then run the command in the terminal before you do anything else.

UPDATE 2

git-core is now an obsolete package in the PPA. The package has been renamed to simply git. I have updated my answer and link accordingly.

Share:
7,455

Related videos on Youtube

Manoj Chauhan
Author by

Manoj Chauhan

Updated on September 18, 2022

Comments

  • Manoj Chauhan
    Manoj Chauhan almost 2 years

    When I run this command:

    apt-get install git-core
    

    It shows:

    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?
    
    • Manoj Chauhan
      Manoj Chauhan over 11 years
      plzz help me whtat to do
  • Manoj Chauhan
    Manoj Chauhan over 11 years
    nothing happening...
  • Kyle Macey
    Kyle Macey over 11 years
    What do you mean by "Nothing Happening"? Are you getting the same error? Are you getting something else? If so, edit your question and post the new results.
  • Manoj Chauhan
    Manoj Chauhan over 11 years
    manu@manu-G31M-ES2L:~$ sudo apt-get install git-core [sudo] password for manu: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
  • Kyle Macey
    Kyle Macey over 11 years
    @ManojChauhan Check my edit
  • Manoj Chauhan
    Manoj Chauhan over 11 years
    thanxx its working ..