Gitlab. Hints
Удаление директории из проекта
If you remove all files from the folder, the folder will disappear.
Загрузить, изменнить и выгрузить файл проекта
Клонируем в любое место на Linux наш проект
mkdir ~/git_projects
cd ~/git_projects
git clone git@gitlab.com:clesssalvein/alefstudio-awx.git
cd ~/alefstudio-awx
Изменяем файл zabbix.py, подготавливаем и пушим его на gitlab
chmod +x inventory/zabbix.py
git add inventory/zabbix.py
git config --global user.name "Cless"
git config --global user.email "clesssalvein@gmail.com"
git commit -m "sync to gitlab zabbix.py"
git push origin
Пример создания репозитория
- добавляем в гитлаб пользователя alefstudio (ему на имэйл придет письмо со ссылкой на создание пароля в веб-интерфейсе)
- логинимся под пользователем alefstudio
- создаем в веб-интерфейсе гитлаба проект с именем "awx"
- на любой машине с линукс создаем директорию awx
- копируем в awx файлы проекта
Например
awx/ ├── inventory/ └── hosts └── mikrotik_create_test_var.yml
cd ./awx
git config --global user.name "alefstudio"
git config --global user.email "alefstudio@yandex.ru"
git init
Для машины в локальной сети
git remote add origin git@192.168.199.241:alefstudio/awx.git
Для машины во внешней сети
git remote add origin git@gitlab.domain123.ru:alefstudio/awx.git
git add .
git commit -m "Initial commit"
git push -u origin master
Проверяем в веб-интерфейсе гитлаб, что файлы успешно выгрузились в проект в ветку master
Работа с ветками
https://www.nobledesktop.com/learn/git/git-branches
List All Branches
NOTE: The current local branch will be marked with an asterisk (*).
To see local branches, run this command:
git branch
To see remote branches, run this command:
git branch -r
To see all local and remote branches, run this command:
git branch -a
Create a New Branch
Run this command to create branch "branch_second"
git checkout -b branch_second
Check if you're really in the "branch_second"
git status
You're now ready to commit to this branch
Create an example file in the new branch
echo second > branch_second.txt
Add changes for commit
git add .
Commit
git commit -m "branch_second created"
Push changes to the new branch in the remote repo
git push -u origin branch_second
Switch to a Branch In Your Local Repo
git checkout my-branch-name
See What Branch You're On
git status
Посмотреть разницу в ветках
Переключиться на ветку
git checkout main
Посмотреть разницу текущей ветки main с веткой branch2
git diff branch2
Login to custom host with custom key
nano ~/.ssh/config
Host gitlab.local IdentityFile ~/.ssh/id_rsa.avchishko