Git - create a warehouse

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

Create a remote warehouse

First, create a warehouse in the code cloud


Get the address of the warehouse after you create it :

Global settings

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

git config --global "yong.yuan"
git config --global ""
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
--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]
--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)
-z, --null terminate values with NUL byte
--includes respect include directives on lookup
For example, get the configuration list
[root@supman ~]# git config -l
Get a configuration separately
[root@supman ~]# git config --get

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
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 (fetch)
origin (push)
Please bring the original link to reprint ,thank
Similar articles