Install Git

Video loading...

  • 0:00
    ♪♫♫♪♫♫♪♪♫♫♪
  • 0:12
    In this next video we're going to be learning how to use a really important tool
  • 0:17
    in the Drupal community. We store all of our code in a version control system called Git.
  • 0:23
    So in order to be able to use the latest development versions people are working on
  • 0:27
    and to help modify those and make changes and test the changes that others are making,
  • 0:32
    we need to use Git to get a copy of our code rather than just downloading that zip
  • 0:38
    or tarball that you normally would. So in this lesson we're going to be looking at
  • 0:42
    how to install Git on your local computer, and then we'll cover some basic Git
  • 0:47
    commands to get you sort of comfortable with it and show you how to use Git to
  • 0:51
    download the latest development version of Drupal 8.
  • 0:55
    So to begin we'll start at a Drupal ladder and we'll move up to the second step which is
  • 0:59
    install Git. I'm going to click on that link, you'll see that we get to a page that actually has
  • 1:04
    quite a lot of information on it. So we're going to break this into three sections.
  • 1:08
    And we're going to start off with installing Git and getting that set up and ready.
  • 1:13
    So when we scroll to that section on the page you'll see there's instructions for
  • 1:16
    Windows, Mac and Linux, but regardless of which operating system you're using
  • 1:21
    you're going to go to git-scm.com for the downloads, and on the downloads page
  • 1:27
    you'll see that it's auto-detecting that I'm on Windows, but the other operating systems
  • 1:33
    are available, so there's Mac. There's also Linux. Now for Linux if you click on this
  • 1:38
    you're going to find text instructions for what commands to run.
  • 1:41
    There's not a downloadable package for that.
  • 1:45
    But we do have Solaris and Linux instructions. We have Windows.
  • 1:48
    I'm on Windows, mostly because there's sort of the most steps involved
  • 1:52
    with Windows. I'm going to save the file to .exe
  • 1:57
    and then I'll open it up once I have it downloaded. And this opens up
  • 2:02
    the installation wizard, and pretty much we're going to be able to just leave
  • 2:05
    the defaults as we go through here. It's your classic kind of setup for a new
  • 2:11
    program that you're installing, where you want it to be, what shortcuts you want
  • 2:15
    and that kind of a thing. So I'm going to go ahead and leave these at defaults
  • 2:19
    although we will talk about one of the options when we get there.
  • 2:22
    So I can leave these. And now we're going to get to a screen that's going to talk about
  • 2:28
    our path environment. In this download Windows provides a program called
  • 2:33
    Git Bash, which will let us use Git just like you would on a Linux system.
  • 2:39
    We could change to be able to use Git from the regular Windows command prompt
  • 2:45
    which you would definitely want to do if you were using something like Cygwin
  • 2:49
    and you wanted to be able to sort of run bash things in your regular terminal
  • 2:54
    We don't really need to do that and in this instance I'm just going to use the Git Bash
  • 2:58
    program that comes with this installation of Git as that's really straightforward and
  • 3:03
    should cover our needs. And the rest of this stuff I'm going to leave again at its default
  • 3:08
    and just continue and finish up the installation. I do not want to see release
  • 3:16
    notes I'm going to turn that off and we'll finish. So now I have that installed locally
  • 3:21
    and if I minimize my browser here you'll see that the default setting was to put a shortcut
  • 3:27
    to Git Bash on my desktop, which is great. So I'm going to go ahead and launch
  • 3:31
    that and lets type the word "git" and hit enter, and I'm getting a whole bunch of
  • 3:36
    help information on the various commands that are available. That means Git is working
  • 3:42
    So we have it installed and Git is actually working. So that has us with a good start.
  • 3:49
    If we go back to the instructions, we scroll down a little bit.
  • 3:54
    You're going to see that there's some next steps with Git.
  • 3:57
    And there's some basic configuration that we want to take care of
  • 4:01
    just to make sure we're all ready to go.
  • 4:02
    They're just copy and paste lines so what I'll need to do is go into my Git Bash or if you're
  • 4:08
    on Mac or Linux you would just open up your terminal, and we're going to go ahead
  • 4:14
    and do these commands so we can get things set up properly.
  • 4:19
    So let me move this kind of out of the way here so I can see what I'm doing.
  • 4:24
    And I'm going to go ahead and clear my screen. And so we just basically we just
  • 4:30
    need to put these commands just as they are so first I need to do the Git config
  • 4:36
    and then dash dash global doesn't mean for all users, it means every instance where this
  • 4:42
    user's doing something globally within Git, not per project. So I'm going to do a global
  • 4:47
    configuration for this user and put my name in. So when I do a commit my name will be
  • 4:53
    associated with it. We need to do a similar thing with email. So in the Git world
  • 4:59
    having your identifying your work with your commits with your name and email address
  • 5:04
    is the standard and so want to set ourselves up to do that properly.
  • 5:08
    So I'll go ahead and put my email address in here. And then last thing is just these
  • 5:17
    line endings, differences between Windows and Linux we're just going to go ahead and
  • 5:23
    set that just to make sure we don't mess up anybody else's work because of our
  • 5:28
    line endings. So if we look at our instructions here it's telling me that this configuration
  • 5:34
    is in my home directory somewhere so let's go take a look and see what happened
  • 5:39
    when we typed those commands, 'cause we didn't see anything on this screen.
  • 5:42
    So I'm going to go into my home directory. I'm the administrator user here.
  • 5:46
    And you'll see there's this file with no name. It's a Git config file.
  • 5:51
    The name of the file is .gitconfig which makes it hidden so you'll need to be able to
  • 5:55
    see hidden files to see it. And then if I go in and open this up with a regular text editor
  • 6:02
    you'll see it's just a text file and the things that I typed into the screen and saw no
  • 6:07
    response, were actually getting written into this file. So that's where my configuration
  • 6:11
    stuff is actually stored. So, we have Git, now let's use it to download a Drupal project
  • 6:20
    and see how that works. So if we scroll down the page here we'll see that we have
  • 6:25
    instructions for downloading a project. There are also instructions for downloading Drupal
  • 6:31
    itself, which we'll get to in the next section. So let's just go ahead and follow the
  • 6:36
    instructions here. First of all we need to make sure we're in the right place.
  • 6:40
    We want to download a module into the modules directory, or a theme into the
  • 6:44
    themes directory. So this is telling me I need to make sure that I'm in the right location
  • 6:49
    because wherever I run the command is where stuff's going to get downloaded.
  • 6:53
    So I'm going to see where I am. Which I'm currently in my "home" directory.
  • 6:58
    And I'm going to move into where my web root is. Which for me is a directory called
  • 7:04
    "websites"; wherever it is for you. And I have a Drupal 7 installation here so I'm
  • 7:08
    in my Drupal 7 installation and of course we always put our modules in "sites/all/modules"
  • 7:13
    So I'm going to move into that directory using "cd" and "ls". These are bash
  • 7:19
    commands, again I'm on Git Bash and not a regular Windows terminal.
  • 7:25
    So I'm in the right place, now let's go find a project. And I'm going to use "Admin menu"
  • 7:28
    as the example here. This is a module I want to download and use on my site
  • 7:32
    and I want to get it using git. So I go to the version control tab
  • 7:36
    all the projects on drupal.org have this. I can pick which version I want
  • 7:42
    it's the 7, I'm using Drupal 7 so I need the 7 version and the 3.x branch would appear
  • 7:48
    to be the most current. And so the instructions that are down here are for me
  • 7:55
    to be able to get them. So basically I just need to be able to copy and paste this.
  • 7:58
    So let me highlight and copy this line. I'm going to "git clone", clone is how you would
  • 8:05
    download a new git project. I'll go into my Git Bash and I'm going to go ahead and
  • 8:12
    just paste that in so I don't have to type it, and hit "enter". And that's going to begin
  • 8:17
    the clone process, which can take a few minutes depending on the size of the project.
  • 8:23
    So I'll let that do what it needs to do, and then once we're done if I do "ls" to list
  • 8:29
    you'll see I now have "admin menu" in my modules directory. And if I go inside of that
  • 8:34
    folder, I actually have the admin menu module.
  • 8:37
    Handy dandy
  • 8:38
    And now I can go enable it and use that module just like anything else.
  • 8:43
    So now that we have a git checkout lets play around with some basic commands.
  • 8:47
    So "git status" is a good one. I can see which branch I'm on, and if I've made any
  • 8:52
    changes locally. Another good one is "git branch" and I do dash "a" (-a) on that
  • 9:00
    and I see not just what my local branch is but also anything that's remote
  • 9:04
    up on drupal.org. So I can see all of the ones that are available,
  • 9:07
    and the one with the star (*) is the one I'm using, which is the 7.3x that I just cloned
  • 9:13
    and then another good basic command to be able to use is "git log".
  • 9:21
    And if I put a dash 3 (-3) after the end it will only bring up the last three commits.
  • 9:27
    So the log is a list of all of the commits so I can see the history of what's going on
  • 9:32
    in this particular branch. So the last three commits are listed here.
  • 9:36
    And I could five or ten or whatever I want.
  • 9:40
    Ok so now let's take a look at downloading Drupal core with git
  • 9:44
    and we're going to download the latest development version of Drupal 8.
  • 9:49
    So, first of all, again I need to make sure I'm in the right location
  • 9:53
    I don't want to download core into my modules directory in another site
  • 9:56
    I want to start a new site. So I need to go back to my web root
  • 9:59
    you can see the Drupal 7 site I was working on and I'm going to put Drupal 8
  • 10:04
    next to it. And if we go back to drupal.org, I'm going to go to the Drupal core
  • 10:10
    project page. And again it has a "version control" tab just like any other project.
  • 10:16
    And when I click there, again I can pick the version, and I want to get the 8.x version
  • 10:20
    which is the latest development work that is going on. And then I can come down
  • 10:25
    and then I can get my clone command for getting that so, copy that.
  • 10:33
    And go back over here to get Git Bash again, just want to make sure I'm in the right
  • 10:37
    place so I'm in my web root directory, where all my websites live.
  • 10:41
    Top level, and then I just need to go in here and paste this command.
  • 10:47
    Do my fun, Git Bash program pasting here. Hit "enter".
  • 10:54
    This is going to take longer than the admin module download did. So it's going to
  • 10:58
    take a little bit of time so just have some patience while it downloads/clones all the
  • 11:03
    files that it needs. And now if I list (ls) you'll see I have Drupal, it just downloads it to
  • 11:09
    a folder called "drupal". I can change that name if I want to.
  • 11:13
    I'll go inside and when I list (ls) the contents you'll see it looks quite different.
  • 11:18
    Drupal 8's file directory structure is different than Drupal 7, so I definitely know I have
  • 11:24
    the right thing. So that's how we use git to get the latest development version
  • 11:28
    of Drupal, and now since I'm using git I can do things like apply patches
  • 11:33
    and create my own patches and help other people with testing and working on making
  • 11:39
    Drupal 8 even better.
  • 0:00
    ♪♫♫♪♫♫♪♪♫♫♪
  • 0:12
    U sljedećem videu naučit ćemo kako koristiti zaista važan alat
  • 0:17
    Drupal zajednice. Sav naš kod spremamo u Git sustav za verzioniranje.
  • 0:23
    Kako bi mogli koristiti najnovije razvojne verzije projekata koje ljudi razvijaju,
  • 0:27
    te ih mijenjati i testirati promjene koje drugi čine,
  • 0:32
    koristimo Git kako bi kopirali kod bez da skidamo .zip
  • 0:38
    ili .tar datoteke kao do sada. U ovoj lekciji ćemo pogledati
  • 0:42
    kako instalirati Git na vašem lokalnom računalu, te proći kroz par osnovnih Git
  • 0:47
    naredbi da dobijete osjećaj kako ga koristiti i kako pomoću njega
  • 0:51
    skinuti najnoviju razvojnu verziju Drupala 8.
  • 0:55
    Započet ćemo sa Drupal ljestvicom i pomaknuti se na drugi korak koji je
  • 0:59
    instaliranje Gita. Nakon što kliknete link otvorit će vam se stranica
  • 1:04
    s mnoštvo informacija koje ćemo podijeliti u tri dijela.
  • 1:08
    Za početak ćemo instalirati i podesiti Git.
  • 1:13
    U navedenom odjeljku na stranici možete vidjeti upute za
  • 1:16
    Windowse, Mac i Linux, ali bez obzira koji operativni sustav koristite
  • 1:21
    trebate otići na git-csm.com adresu gdje će na stranici za skidanje
  • 1:27
    automatski prepoznati kako koristim Windowse, ali dostupni su i ostali
  • 1:33
    operativni sustavi poput Maca i Linuxa. Za Linux postoje
  • 1:38
    samo tekstualne upute s naredbama koje treba izvršiti.
  • 1:41
    Ne postoji datoteka koju treba skinuti.
  • 1:45
    Dakle imamo upute za Solaris i Linux, ali kako sam ja na
  • 1:48
    Windowsima, te zato što je većina koraka povezana s
  • 1:52
    Windowsima, skinut ću .exe datoteku
  • 1:57
    i otvoriti ju nakon što se skine. To će otvoriti
  • 2:02
    čarobnjaka za instalaciju u kojem možemo sve postavke
  • 2:05
    ostaviti zadanima. Radi se o klasičnom načinu podešavanja
  • 2:11
    novog programa prilikom instalacije, gdje ga instalirati, želim li prečicu
  • 2:15
    i slično. Sve ću navedeno ostaviti na zadanim vrijednostima
  • 2:19
    dok ne dođemo do određene postavke o kojoj ćemo reći nešto više.
  • 2:22
    Sve ćemo to ostaviti dok ne dođemo do koraka u kojem ćemo pričati o
  • 2:28
    putanjama. Windows instalacijski paket dolazi s programom
  • 2:33
    Git Bash koji omogućava korištenje Gita kao da se radi o Linux sustavu.
  • 2:39
    Možemo odabrati koristiti Git iz uobičajenog Windows komandnog sučelja
  • 2:45
    što sigurno želite ako koristite nešto poput Cygwin programa
  • 2:49
    i želite pokretati bash naredbe iz običnog terminala.
  • 2:54
    Kako nama to ne treba odabrat ću Git Bash
  • 2:58
    program koji dolazi s ovom instalacijom Gita i koji će
  • 3:03
    moći pokriti sve naše potrebe. Sve ostalo ćemo opet ostaviti zadano
  • 3:08
    te nastaviti prema svršetku instalacije. Ne želim vidjeti obavijesti
  • 3:16
    o izdanju, isključit ću to i gotovi smo. Budući da smo ga instalirali lokalno,
  • 3:21
    ako smanjim preglednik vidjet ćete kako je zadana postavka bila postaviti Git Bash
  • 3:27
    prečicu na desktop, što je odlično. Pokrenut ću ga
  • 3:31
    i upisati riječ "git" i stisnuti enter nakon čega ću dobiti mnoštvo
  • 3:36
    informacija o raznim dostupnim naredbama. To znači kako Git radi.
  • 3:42
    Instalirali smo Git i on zaista radi, što je odličan početak.
  • 3:49
    Ako se vratimo na upute i pogledamo malo niže
  • 3:54
    vidjet ćete kako nam predstoje naredni koraci s Gitom.
  • 3:57
    Trebamo podesiti neke osnovne postavke
  • 4:01
    kako bismo mogli krenuti dalje.
  • 4:02
    Radi se o par linija koje trebamo prekopirati, a to ćemo učiniti
  • 4:08
    pomoću Git Basha, ili običnog terminala ako koristite Mac ili Linux,
  • 4:14
    nakon čega ćemo imati sve uredno postavljeno.
  • 4:19
    Samo da pomaknem prozor kako bih vidjela što radim.
  • 4:24
    Izbrisat ću trenutni zaslon, a onda u pravilu samo trebamo
  • 4:30
    upisati navedene naredbe takve kakve jesu, dakle prvo
  • 4:36
    "git config --global", pri čemu global ne znači za sve korisnike, već svugdje
  • 4:42
    gdje korisnik radi s Gitom globalno, a ne po projektu. Dakle, unosimo
  • 4:47
    globalnu postavku za ime za trenutnog korisnika. Upisat ću vlastito ime
  • 4:53
    kako bi promjene koje spremim bile povezane sa mnom. To isto trebamo učiniti i za e-mail.
  • 4:59
    U Git svijetu vaše promjene i rad su identificirane pomoću vašeg imena i e-mail adrese,
  • 5:04
    to je standard i trebamo to obaviti kako treba.
  • 5:08
    Upisat ću svoju adresu ovdje i onda još samo jednu stvar, a to je
  • 5:17
    postaviti završetak linije zbog razlika između Windowsa i Linuxa,
  • 5:23
    kako slučajno ne bi zamrsili tuđi rad zbog krivog završetka linije.
  • 5:28
    Ako pogledamo u upute vidjet ćemo kako je postavljena konfiguracija
  • 5:34
    dostupna negdje u mom kućnom direktoriju, hajdemo ju potražiti i vidjeti
  • 5:39
    što se dogodilo nakon što smo izvršili naredbe od maloprije.
  • 5:42
    Idem u svoj kućni direktorij. Moj korisnik je administrator.
  • 5:46
    Bezimena datoteka koju vidite je Git konfiguracijska datoteka.
  • 5:51
    Ime datoteke glasi ".gitconfig" što ju čini skrivenom, tako da ćete ju vidjeti samo ako
  • 5:55
    možete vidjeti skrivene datoteke. Ako ju otvorim uobičajenim tekstualnim editorom
  • 6:02
    vidjet ćete kako se radi o običnoj tekstualnoj datoteci
  • 6:07
    u kojoj se nalaze postavke koje smo upisivali maločas.
  • 6:11
    Dakle, to je mjesto gdje je spremljena konfiguracija. Sada kada imamo Git pogledajmo kako ga koristiti
  • 6:20
    za skidanje Drupal projekta. Ako pogledamo niže na stranici
  • 6:25
    vidjet ćemo upute za skidanje projekta. Postoje također i upute za skidanje samog Drupala,
  • 6:31
    što ćemo obraditi u sljedećem dijelu. Hajdemo slijediti upute.
  • 6:36
    Prvo moramo biti sigurni da se nalazimo na pravom mjestu.
  • 6:40
    Želimo skinuti modul u direktorij za module, a temu u
  • 6:44
    direktorij za teme. Trebam se pobrinuti kako sam na pravom mjestu
  • 6:49
    jer gdjegod da pokrenem naredbu ona će izvršiti skidanje u direktoriju u kojem se nalazim.
  • 6:53
    Pogledat ću gdje se trenutno nalazim. U vlastitom kućnom direktoriju.
  • 6:58
    Idem u direktorij u kojem se nalaze moje web stranice, koji se u mom slučaju zove "websites".
  • 7:04
    U njemu imam Drupal 7 instalaciju pa ćemu ući u taj direktorij,
  • 7:08
    a module uvijek smještamo u "sites/all/modules" direktorij.
  • 7:13
    Preselit ću se u spomenuti direktorij koristeći "cd" i "ls".
  • 7:19
    To su bash naredbe koje izvršavam u Git Bash programu, a ne u običnom Windows terminalu.
  • 7:25
    Na pravom sam mjestu, još nam samo treba projekt. Iskoristit ćemo "Admin menu"
  • 7:28
    kao primjer. To je modul koji želim skinuti pomoću Gita kako bi ga
  • 7:32
    koristila na vlastitoj stranici. Odem na (eng.) "version control" tab
  • 7:36
    kojeg imaju svi projekti na drupal.org. Odaberem verziju koju želim,
  • 7:42
    a to je 7 jer koristimo Drupal 7, dok je grana 3.x najaktualnija.
  • 7:48
    U pravilu samo trebam iskopirati upute
  • 7:55
    koje se nalaze ispod kako bi skinula modul.
  • 7:58
    Obilježit ću i kopirati "git clone" naredbu. Kloniranje je proces
  • 8:05
    skidanja novog git projekta. Nakon što smo kopirali naredbu idemo u Git Bash
  • 8:12
    te ju samo zalijepimo bez da išta ručno upisujemo i pritisnemo enter.
  • 8:17
    To će pokrenuti proces kloniranja koji zna potrajati ovisno o veličini projekta.
  • 8:23
    Nakon što proces završi, pomoću "ls" naredbe
  • 8:29
    možete vidjeti kako sada imam novi direktorij "admin_menu"
  • 8:34
    unutar kojeg se nalazi "Admin menu" modul.
  • 8:37
    Zgodno!
  • 8:38
    Sada mogu omogućiti modul i koristiti ga kao i sve ostale.
  • 8:43
    Sada kada smo savladali osnovnu Git naredbu, pogledajmo još neke osnovne komande.
  • 8:47
    "git status" je korisna naredba koja nam govori na kojoj smo grani i jesmo li
  • 8:52
    učinili lokalne promjene. Druga je "git branch -a" koja će mi
  • 9:00
    pokazati ne samo lokalne grane, već i sve udaljene
  • 9:04
    na drupal.org. Mogu vidjeti sve dostupne,
  • 9:07
    a grana sa zvjezdicom je ona koju trenutno koristim, 7.x-3.x koju smo klonirali.
  • 9:13
    Još jedna dobra osnovna naredba jest "git log".
  • 9:21
    Ako dodamo naredbi argument "-3" ispisat će nam samo posljednja tri spremanja.
  • 9:27
    Log naredba ispisuje sva spremanja i daje uvid u povijest
  • 9:32
    određene grane. Zadnja tri spremanja su izlistana.
  • 9:36
    Mogu ih izlistati koliko god želim.
  • 9:40
    OK, ajmo sada pogledati kako skinuti Drupal jezgru pomoću Gita,
  • 9:44
    t.j. najnoviju razvojnu verziju Drupal 8.
  • 9:49
    Kao i prije, moram biti sigurna da sam na pravom mjestu.
  • 9:53
    Ne želim skinuti jezgru u direktorij za module od neke druge stranice.
  • 9:56
    Želim pokrenuti novu stranicu u mom direktoriju za web stranice.
  • 9:59
    U njemu vidite Drupal 7 stranicu, a Drupal 8 ću postaviti odmah pored.
  • 10:04
    Vratimo se na drupal.org, na stranicu projekta od Drupal jezgre.
  • 10:10
    Kao i svi ostali projekti i ova stranica ima "version control" tab.
  • 10:16
    Nakon što kliknem na njega mogu odabrati verziju, a želim 8.x verziju
  • 10:20
    u kojoj se nalaze najnovije razvojne promjene.
  • 10:25
    Ispod mogu pronaći naredbu za kloniranje koju ću kopirati.
  • 10:33
    Vratimo se opet u Git Bash i provjerimo za svaki slučaj jesmo li
  • 10:37
    na pravom mjestu gdje se nalaze sve ostale web stranice.
  • 10:41
    Sada samo trebam zalijepiti naredbu.
  • 10:47
    Zalijepim naredbu u Git Bash program i stisnem enter.
  • 10:54
    Ovo će potrajati malo duže nego skidanje admin modula,
  • 10:58
    tako da imajte strpljenja dok ne završi kloniranje svih potrebnih datoteka.
  • 11:03
    Ako sada izlistam sadržaj direktorija vidjet ćete novi direktorij
  • 11:09
    nazvan "drupal" kojem mogu promijeniti ime ako želim.
  • 11:13
    Ako uđem u njega te izlistam sadržaj vidjet ćete kako izgleda dosta različito.
  • 11:18
    Struktura direktorija Drupal 8 je različita od Drupal 7, tako da definitivno znam kako imam
  • 11:24
    pravu stvar. Dakle, tako koristimo Git da dobijemo najnoviju razvojnu verziju
  • 11:28
    Drupala, a kako koristimo Git možemo raditi stvari poput primijenjivanja zakrpa
  • 11:33
    i kreiranja vlastih zakrpa, te pomoći ostalim ljudima u testiranju i raditi na izradi
  • 11:39
    još bolje Drupal osmice.

Install Git

Loading...

In this video we walk through getting Git version control installed, and then show how to do a few basic things, including how to get a copy of the latest Drupal development code. This video follows the instructions found in the Install Git lesson on learndrupal.org.

This video is installing Git on Windows, because it has the most steps involved. Installation on Mac and Linux is very simple, in that they do not have a wizard to walk through, so they are not demonstrated. All commands used on the command line in the video work on Windows, Mac, and Linux, because Windows is using the Git Bash shell which is part of the Git installation.

Resources: 

Average review

0
No votes yet

Reviews