First installation configuration
#Configure mailbox with the same account name git config --global user.name “Your_github-Username” git config --global user.email “Your_github-email” #View user name mailbox git config user.name git config user.email #You can also view user mailboxes directly vim ~/.gitconfig : q Exit
ssh-keygen -t rsa -C "your_github-email"
| |
---|---|
| |
| |
Other commands
Git upload
The remote warehouse is empty
git init
Git remote add origin HTTPS address of github warehouse
Git add.//All contents in the current directory Git add user//Specify a file or folder Git status//View the cache file
git commit -m 'first commit'
Git branch xxx//Create a branch Git branch - a//View branches Git checkout xxx//Switch branches
git push -u origin master
The remote warehouse is not empty
Git clone warehouse address
Git add.//All contents in the current directory Git add user//Specify a file or folder Git status//View the cache file
git commit -m 'first commit'
git push origin master
Delete warehouse file
Git clone warehouse address //Negligible Git rm file//The local file will be deleted Git rm - r folder//local will be deleted Git rm - rf.//All local files will be deleted Git commit - m 'Delete a file' git push origin master
Git clone warehouse address //Negligible Git rm -- cached file//The local file will not be deleted Git rm - r -- cached folder//Local will not be deleted Git rm - rf -- cached.//All local files will not be deleted Git commit - m 'Delete a file' git push origin master