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

  1. git clone git@gitlab.com:fredericgalliano/<projet>.git ⇒ creates the directory <projet>/.
  2. cd <projet>.
  3. Create a file README.md, e.g. touch README.md.
  4. git add README.md.
  5. git commit -m "add README".
  6. git push -u origin master.

2.2 Creating a New Project from an Existing Local Directory

  1. cd <projet>.
  2. git init.
  3. git remote add origin gitlab.com:fredericgalliano/<projet>.git.
  4. git add ..
  5. git commit -m "Initial commit".
  6. git push -u origin master.

2.3 Update a File to Gitlab

  1. git add <file>.
  2. git commit -m "add <file>".
  3. git push -u origin master.

2.4 Update a project from Gitlab

git pull origin master

2.5 Clone a Project

  1. git init ⇒ creates ./.git/.
  2. git clone git@gitlab.com:gitlab-org/project.git.

2.6 Remove a Project from The Web Interface

Project → Settings → Advanced settings → Remove project


BACK

Author: F. Galliano
Last update: 05 janv. 2024