<linkrel="alternate"lang="fr"xml:lang="fr"title="Git pour les nuls"type="text/html"hreflang="fr"href="/Scratch/fr/blog/2009-11-12-Git-for-n00b/conf-et-install/"/>
<linkrel="alternate"lang="en"xml:lang="en"title="Git for n00b"type="text/html"hreflang="en"href="/Scratch/en/blog/2009-11-12-Git-for-n00b/conf-et-install/"/>
<divid="sousliens"><ul><li><ahref="/Scratch/en/blog/2009-11-12-Git-for-n00b/">introduction</a></li><li><ahref="/Scratch/en/blog/2009-11-12-Git-for-n00b/Git-pour-quoi-faire/">Git for what?</a></li><li><spanclass="active"title="You're here.">Configure before Use</span></li><li><ahref="/Scratch/en/blog/2009-11-12-Git-for-n00b/c-est-parti-pour-l-aventure/">The Adventure Begins</a></li><li><ahref="/Scratch/en/blog/2009-11-12-Git-for-n00b/comprendre/">Understanding</a></li><li><ahref="/Scratch/en/blog/2009-11-12-Git-for-n00b/commandes-avancees/">Command List</a></li></ul></div>
<p>You can achieve the same result using for each entry the command: <code>git config --global</code>. Next, configure your name and your email. For example, if your name is John Doe and your email is <code>john.doe@email.com</code>. Launch the following commands:</p>
<p>Here it is. Base configuration is over. The file containing alias will help to type shorter commands.</p>
<h2id="get-a-project">Get a project</h2>
<p>If a project is already versionned with <ahref="http://git-scm.org"title="Git">Git</a> you should have an <code>URL</code> of the sources. Then use the following command:</p>
<div><preclass="twilight">
$ cd <spanclass="Keyword">~</span>/Projets
$ git clone git://main.server/path/to/file
</pre></div>
<p>If there is no git server but you’ve got an <code>ssh</code> access. Just replace the <code>git://host</code> by <code>ssh://user@host</code>. In order not to type your password each time, use:</p>
<div><preclass="twilight">
$ ssh-keygen -t rsa
</pre></div>
<p>Reply to question and <em>*do not enter</em> a password. Then copy your keys to the distant server. This is not the safest way to do this. The safest being, using <code>ssh-agent</code>.</p>
<p>Let do a small remark. If you don’t want to <em>version</em> every file. Typically intermediate compilation file, swap files… Then you need to exclude them. Just before launching the <code>git add .</code> command. You need to create a <code>.gitignore</code> file in the root directory of your project. This file will contain all exclude <em>pattern</em>. For example:</p>
<div><preclass="twilight">
*.o
*.bak
*.swp
*~
</pre></div>
<p>Now, if you want to create a repository on a distant server, it <em>must</em> not be in <code>bare</code> mode. The repository will contain only versionning informations, but not the files of the project. To achieve that:</p>
<div><preclass="twilight">
$ cd /path/to/local/project
$ git clone --bare . ssh://server/path/to/project
</pre></div>
<p>Others will be able to get your modifications.</p>
<div><preclass="twilight">
git clone ssh://server/path/to/project
</pre></div>
<h2id="abstract-of-the-second-step">Abstract of the second step</h2>
<p>You now have a local directory on your computer. It is versionned and you can say it is, because there is a <code>.git</code> directory at the root (and the root only) of your project. This directory contain all necessary informations for <ahref="http://git-scm.org"title="Git">Git</a> to version your project.</p>