NOTES ON GIT
1 CONFIGURATION
1.1 Initialization
- Version:
git --version
.- Identity:
git config --global user.name "fredericgalliano"
.- Address:
git config --global user.email "xxxxxxxx.xxxxxxxx@cea.fr"
.
1.2 Information
- Registered information:
git config --global --list
.- In the project directory:
git remote -v
⇒ list.- Project status
git status
.
1.3 SSH key for Gitlab
gpg2 --export-ssh-key xxxxxxxx.xxxxxxxx@cea.fr
⇒ print the public key to be copied.- On the
GitLab
page → avatar → settings → SSH key.
2 MANAGING A PROJECT
2.1 Creating a New Empty Project
git clone git@gitlab.com:fredericgalliano/<projet>.git
⇒ creates the directory<projet>/
.cd <projet>
.- Create a file
README.md
, e.g.touch README.md
. git add README.md
.git commit -m "add README"
.git push -u origin master
.
2.2 Creating a New Project from an Existing Local Directory
cd <projet>
.git init
.git remote add origin gitlab.com:fredericgalliano/<projet>.git
.git add .
.git commit -m "Initial commit"
.git push -u origin master
.
2.3 Update a File to Gitlab
git add <file>
.git commit -m "add <file>"
.git push -u origin master
.
2.4 Update a project from Gitlab
git pull origin master
2.5 Clone a Project
git init
⇒ creates./.git/
.git clone git@gitlab.com:gitlab-org/project.git
.