Initializing and synchronizing a Git repository » History » Version 2

Version 1 (ROQUE, Damien, 01/24/2015 12:38 AM) → Version 2/3 (ROQUE, Damien, 01/24/2015 12:40 AM)

h1. Initializing and synchronizing a Git repository

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@.

h2. Repository initialization and remote configuration

Create a new directory named after @my_project@ and initialize a Git structure inside it.
<pre>
mkdir my_project
cd my_project
git init
</pre>

Connect the local repository to the remote SourceForge, this links is named @origin@.
<pre>
git remote add origin https://sourceforge.isae.fr/git/my_project
</pre>

h2. First commit and push to the remote repository directory

Create and add a dummy file to the repository (to be adapted to something useful).
<pre>
echo "This is a test file" > file1.txt
git add file1.txt
</pre>

Commit the changes locally and push the changes to the remote repository.
<pre>
git commit -m "My first commit including a dummy file"
git push origin master
</pre>
Notice that the last instruction can be abbreviated by @git push@ if the remote identifier and branch are set as default.
<pre>
git push --set-upstream origin master
</pre>