- ====== GIT ======
- ===== Installation on debian =====
- apt update
- apt upgrade
- apt install git
- ===== Getting Started =====
- CD /
- mkdir git
- git config
- git config --global user.name "Charles"
- git config --global user.email "cc@mail.com"
- ===== Checking settings =====
- git config --list
- nano ~/.gitconfig
- git config user.name
- ===== Help =====
- git help
- git help config
- ==== Initializing a repository in an existing directory ====
- git start
- empty Git repository in /git/.git/
- ls .git
- HEAD branches config description hooks info objects refs
- ==== Uploading files ====
- nano firstfile.txt // write something inside
- git add firstfile.txt // add the file
- git commit -m 'first file uploaded'
- [master (root-commit) 454b8e8] first file uploaded
- 1 file changed, 3 insertions(+)
- create mode 100644 firstfile.txt
- ==== Generate ssh-keygen ====
- ssh-keygen // carlos__--
- cd @/.ssh
- ls // id_rsa id_rsa.pub
- From git@git:~/
- touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
- ==== We generate the keys in the user who wants to connect to git ====
- carlos@deb412:~$ ssh-keygen
- /home/carlos/.ssh/id_rsa.carlos.deb412
- Charles__--
- In .ssh id_rsa.carlos.deb412 and id_rsa.carlos.deb412.pub will appear
- ==== Now this public key should be added to the authorized file on the git server ====
- Upload the key to the server:
- git@git:~/.ssh$ scp -r carlos@192.168.4.102:/home/carlos/.ssh/id_rsa.carlos.deb412.pub ~/.ssh
- Copy it into authorized_keys
- git@git:~/.ssh$ cat id_rsa.carlos.deb412.pub >> authorized_keys
- ==== We create a .git project on the git server ====
- git@git:~/$ mkdir project.git
- cd project.git
- git init --bare
- Initilized empty Git repository in /home/git/project.git/
- ==== From the client carlos@deb412 ====
- First install git (if not already installed)
- root@deb412:/home/carlos# apt install git
- From the user:
- carlos@deb412:~$ mkdir git-project
- carlos@deb412:~$ cd git-project
- carlos@deb412:~/git-project$ git init
- Initilized empty Gir repository in /home/carlos/git-project/.git
- git add .
- git commit -m 'Initial commit'
- git remote add source git@192.168.4.11:/home/git/project.git
- git push source master
- git clone git@192.168.4.11:/home/git/project.git
- cd project
- nano READ ME
- git add LEEM
- git commit -am 'README file'
- git push source master
- git remote add source git@192.168.4.11:/home/git/project.git
- git push source master
Raw Paste