Initializing and synchronizing a Git repository » History » Version 2
ROQUE, Damien, 01/24/2015 12:40 AM
1 | 1 | ROQUE, Damien | h1. Initializing and synchronizing a Git repository |
---|---|---|---|
2 | 1 | ROQUE, Damien | |
3 | 1 | ROQUE, Damien | This documentation explains how to create a Git repository synchronized with a SurceForge project. For ease of use, we will assume in the following that the project identifier and the repository name are identical : @my_project@. |
4 | 1 | ROQUE, Damien | |
5 | 1 | ROQUE, Damien | h2. Repository initialization and remote configuration |
6 | 1 | ROQUE, Damien | |
7 | 1 | ROQUE, Damien | Create a new directory named after @my_project@ and initialize a Git structure inside it. |
8 | 1 | ROQUE, Damien | <pre> |
9 | 1 | ROQUE, Damien | mkdir my_project |
10 | 1 | ROQUE, Damien | cd my_project |
11 | 1 | ROQUE, Damien | git init |
12 | 1 | ROQUE, Damien | </pre> |
13 | 1 | ROQUE, Damien | |
14 | 1 | ROQUE, Damien | Connect the local repository to the remote SourceForge, this links is named @origin@. |
15 | 1 | ROQUE, Damien | <pre> |
16 | 1 | ROQUE, Damien | git remote add origin https://sourceforge.isae.fr/git/my_project |
17 | 1 | ROQUE, Damien | </pre> |
18 | 1 | ROQUE, Damien | |
19 | 2 | ROQUE, Damien | h2. First commit and push to the remote repository |
20 | 1 | ROQUE, Damien | |
21 | 1 | ROQUE, Damien | Create and add a dummy file to the repository (to be adapted to something useful). |
22 | 1 | ROQUE, Damien | <pre> |
23 | 1 | ROQUE, Damien | echo "This is a test file" > file1.txt |
24 | 1 | ROQUE, Damien | git add file1.txt |
25 | 1 | ROQUE, Damien | </pre> |
26 | 1 | ROQUE, Damien | |
27 | 1 | ROQUE, Damien | Commit the changes locally and push the changes to the remote repository. |
28 | 1 | ROQUE, Damien | <pre> |
29 | 1 | ROQUE, Damien | git commit -m "My first commit including a dummy file" |
30 | 1 | ROQUE, Damien | git push origin master |
31 | 1 | ROQUE, Damien | </pre> |
32 | 1 | ROQUE, Damien | Notice that the last instruction can be abbreviated by @git push@ if the remote identifier and branch are set as default. |
33 | 1 | ROQUE, Damien | <pre> |
34 | 1 | ROQUE, Damien | git push --set-upstream origin master |
35 | 1 | ROQUE, Damien | </pre> |