Initializing and synchronizing a Git repository¶
This documentation explains how to create a Git repository synchronized with a SourceForge project. For ease of use, we will assume in the following that the project identifier and the repository name are identical : my_project
.
Optional: configuring Git user identity¶
If you are using Git for the first time, you should first consider setting user related parameters. If already used Git on your user session, you can skip this step.
git config --global user.name <name> git config --global user.email <email>
Repository initialization and remote configuration¶
Create a new directory named after my_project
and initialize a Git structure inside it.
mkdir my_project cd my_project git init
Connect the local repository to the remote SourceForge, this links is named origin
.
git remote add origin https://sourceforge.isae.fr/git/my_project
First commit and push to the remote repository¶
Create and add a dummy file to the repository (to be adapted to something useful).
echo "This is a test file" > file1.txt git add file1.txt
Commit the changes locally and push the changes to the remote repository.
git commit -m "My first commit including a dummy file" git push origin master
Notice that the last instruction can be abbreviated by
git push
if the remote identifier and branch are set as default.git push --set-upstream origin master
Updating changes from remote users¶
If you are collaborating with other users (or using several computers), you can update your local repository thanks to the following instruction.
git pull