Ubuntu: gitee and gitlab installation and user manual

Git installation and usage instructions

ps: You can log in to gitee first, create an empty warehouse, and then there will be operation prompts, follow the operation prompts to configure

install git​

$ apt update; 
$ apt install git
#生成公钥key
$  [email protected]                         #查看是否有公钥
$  ssh-keygen -t rsa -C"[email protected]"         #获取公钥,邮箱为git的登录邮箱

After ##ps is generated, the file is id_rsa.pub under the .ssh file in the user directory

Add the obtained public key to the settings of gitee, the location is as follows:

Select file configuration git

Git global settings:

$ git config --global user.name "Like first sight"

$ git config --global user.email "12294077+[email protected]"

Create a git repository:

## ps: git config http.postBuffer 3060000 (bit) can expand the buffer space and increase the upload rate

$ mkdir driver_ft                             #创建本地仓库文件
$ cd driver_ft
$ git init                                    #初始化
$ git clone "git的http/ssh链接"
#进入本地仓库文件 (clone后出现的文件夹)
$ cd xxx 
#创建新文件或者添加需要入库的文件
$ touch README.md
$ git add 文件路径及文件名                       #将文件提交到缓冲空间
$ git commit -m"first commit9"                #提交缓冲空间的文件,并包含一条描述内容
$ git remote add origin https://gitee.com/nxbing/driver_ft.git
$ git push -u origin "master"

Gitlab installation and usage instructions

#秘钥问题和gitee解决方式相同
$ git init 
$ git config --global user.name "nxbing"
$ git config --global user.email "[email protected]"
$ git config --global credential.helper wincred #存储凭证 (可用于输入一次用户密码后,不再输入)
$ git config http.postBuffer 5160000 #分配足额空间
$ git status    #查看所在分支,如果不同可以通过git checkout  分支名  的方式更改
$ git fetch origin nxbing-main-patch-43361(这个是分支名)   #同步远程服务器上的数据到本地
$ git checkout nxbing-main-patch-43361  #转换分支
$ ls         #查看是否拉取成功
# git clone "git的http/ssh链接"
$ git add 文件路径及文件名                                                                          #将文件提交到缓冲空间
$ git commit -m "first commit9"                                                               #提交缓冲空间的文件,并包含一条描述内容
$ git remote add origin https://gitee.com/nxbing/driver_ft.git
$ git push -u origin  "分支名"
#以后使用直接通过add、commit和push指令即可上传更新服务器仓库

Guess you like

Origin blog.csdn.net/NXBBC/article/details/129548116