Git- Git repositories
1, before the initial run Git configuration ($ git config)
When you install Git should do first thing is to set your user name and e-mail address. Doing so is important because each submission of a Git will use that information, and it is written to each of you commit, can not be changed:
$ git config --global user.name "fancyop"
$ git config --global user.email "[email protected]"
.gitconfig files in the user directory can see the changes over the above user information:
$ cat ~/.gitconfig
[user]
name = fancyop
email = [email protected]
If you want to check your configuration, you can use the git config --list
command to list all the configuration Git can find at that time, user.name lists the user name currently set, user.email lists the current user's mailbox settings:
$ git config --list
$ git config user.name
$ git config user.email
2, Getting Help
If you need help using Git, there are three ways to find Git command manual:
$ git help <verb>
$ git <verb> --help
$ man git-<verb>
<verb> required with alternative keywords to get help, (third method requires to install the current environment man, git bash windows environment is not) such as:
$ git help config
$ git config --help
$ man git-config
3, access to warehouses and delete warehouse
3.1, get a warehouse there are ways Git repository project two made. The first is to import all the files in the existing project or directory to Git; the second is to clone an existing Git repository from a server.
3.1.1 introducing step in an existing project or directory:
$ git init
$ git add *.c
$ git add README.md
$ git commit -m 'first version'
$ Git init, this command creates a subdirectory named .git of this subdirectory contains all the files that you must initialize the Git repository, these files are the backbone Git repository.
$ Git add commands to achieve the specified trace file, add the files to be recorded to the staging area.
$ Git commit to add a file to be submitted to the staging area.
3.1, clone an existing warehouse ($ git clone):
$ git clone https://github.com/fancyop/GitTest.git
GitTest on command creates a folder in the current directory, if you need to customize the name of a local warehouse as myGitTest, you can use the command:
$ git clone https://github.com/fancyop/GitTest.git myGitTest
3.2, delete warehouse
Only need to delete the .git folder
$ rm -rf .git/
@ 2019-05-22 10:42. Posted OpFancy read (...) Comments (...) edit collections