Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 52 lines (36 sloc) 1.923 kB
f61da79 @schacon got a good amount of the first section done or imported from the user…
schacon authored
1 ## Getting a Git Repository ##
2
0f20ba9 @charlieok Minor edits to "Getting a Git Repository" section. (06a in source)
charlieok authored
3 So now that we're all set up, we need a Git repository. We can do this one of
f61da79 @schacon got a good amount of the first section done or imported from the user…
schacon authored
4 two ways - we can *clone* one that already exists, or we can *initialize* one
0f20ba9 @charlieok Minor edits to "Getting a Git Repository" section. (06a in source)
charlieok authored
5 either from existing files that aren't in source control yet, or from an empty
6 directory.
f61da79 @schacon got a good amount of the first section done or imported from the user…
schacon authored
7
8 ### Cloning a Repository ###
9
0f20ba9 @charlieok Minor edits to "Getting a Git Repository" section. (06a in source)
charlieok authored
10 In order to get a copy of a project, you will need to know the project's Git
11 URL - the location of the repository. Git can operate over many different
12 protocols, so it may begin with ssh://, http(s)://, git://, or just a username
13 (in which case git will assume ssh). Some repositories may be accessed over
14 more than one protocol. For example, the source code to Git itself can be
15 cloned either over the git:// protocol:
c0fee25 @schacon added cloning
schacon authored
16
17 git clone git://git.kernel.org/pub/scm/git/git.git
18
19 or over http:
20
21 git clone http://www.kernel.org/pub/scm/git/git.git
22
0f20ba9 @charlieok Minor edits to "Getting a Git Repository" section. (06a in source)
charlieok authored
23 The git:// protocol is faster and more efficient, but sometimes it is
24 necessary to use http when behind corporate firewalls or what have you. In
25 either case you should then have a new directory named 'git' that contains all
26 the Git source code and history - it is basically a complete copy of what was
27 on the server.
f61da79 @schacon got a good amount of the first section done or imported from the user…
schacon authored
28
0f20ba9 @charlieok Minor edits to "Getting a Git Repository" section. (06a in source)
charlieok authored
29 By default, Git will name the new directory it has checked out your cloned
30 code into after whatever comes directly before the '.git' in the path of the
31 cloned project. (ie. *git clone
32 http://git.kernel.org/linux/kernel/git/torvalds/linux-2.6.git* will result in
33 a new directory named 'linux-2.6')
2257482 @schacon added the installing chapter and expanded the diff chapter
schacon authored
34
f61da79 @schacon got a good amount of the first section done or imported from the user…
schacon authored
35 ### Initializing a New Repository ###
36
0f20ba9 @charlieok Minor edits to "Getting a Git Repository" section. (06a in source)
charlieok authored
37 Assume you have a tarball named project.tar.gz with your initial work. You can
38 place it under git revision control as follows.
c0fee25 @schacon added cloning
schacon authored
39
40 $ tar xzf project.tar.gz
41 $ cd project
42 $ git init
43
44 Git will reply
45
46 Initialized empty Git repository in .git/
47
48 You've now initialized the working directory--you may notice a new
49 directory created, named ".git".
f61da79 @schacon got a good amount of the first section done or imported from the user…
schacon authored
50
b67b93f @schacon added images, linkgits and gitcasts to the templates
schacon authored
51 [gitcast:c1_init](GitCast #1 - setup, init and cloning)
Something went wrong with that request. Please try again.