Git - create a warehouse

Xiao Yongyong 2021-09-15 10:41:50

Create a remote warehouse

First, create a warehouse in the code cloud

image.png

Get the address of the warehouse after you create it :https://gitee.com/codeyuany/g...

Global settings

First, you can set up some personal information in your local environment

git config --global user.name "yong.yuan"
git config --global user.email "1218639030@qq.com"
After setting, you can use config Some related commands to view the configured information .
[root@supman ~]# git config
usage: git config [options]
Config file location
--global use global config file
--system use system config file
--local use repository config file
-f, --file <file> use given config file
--blob <blob-id> read config from given blob object
Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp get values for regexp: name-regex [value-regex]
--replace-all replace all matching variables: name value [value_regex]
--add add a new variable: name value
--unset remove a variable: name [value-regex]
--unset-all remove all matches: name [value-regex]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
-e, --edit open an editor
--get-color <slot> find the color configured: [default]
--get-colorbool <slot>
find the color setting: [stdout-is-tty]
Type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)
Other
-z, --null terminate values with NUL byte
--includes respect include directives on lookup
For example, get the configuration list
[root@supman ~]# git config -l
user.name=yong.yuan
user.email=1218639030@qq.com
Get a configuration separately
[root@supman ~]# git config --get user.name
yong.yuan

Initialize the repository

Create a folder , And initialize the local warehouse , Add remote repository - remote long-range 、 origin The source of the
[root@supman ~]# mkdir git
[root@supman ~]# cd git
[root@supman git]# git init
Initialized empty Git repository in /root/git/.git/
[root@supman git]# git remote add origin https://gitee.com/codeyuany/git.git
After initializing the warehouse, we will find that there is nothing in the folder
[root@supman git]# ls
But in fact, there is a hidden in the folder .git file
[root@supman git]# ls -al
total 12
drwxr-xr-x 3 root root 4096 Aug 31 20:57 .
dr-xr-x---. 9 root root 4096 Aug 31 20:56 ..
drwxr-xr-x 7 root root 4096 Aug 31 20:57 .git
There are all kinds of... In this file git All kinds of information , Delete this .git After the file, this folder is an ordinary folder
[root@supman git]# cd .git
[root@supman .git]# ls
branches config description HEAD hooks info objects refs
Use git remote -v You can see the remote warehouse information associated with the local warehouse , The remote warehouse we just added .
[root@supman .git]# git remote -v
origin https://gitee.com/codeyuany/git.git (fetch)
origin https://gitee.com/codeyuany/git.git (push)
Please bring the original link to reprint ,thank
Similar articles

2021-09-15

2021-09-15