1. Create a new project repository
2. Fill in the project warehouse information and confirm
Git bash: Download git bash, open git bash, and CD to your local project.
4. Upload the node_modules file
Create gitignore.txt in the root directory of Windows. Edit gitignore. TXT and write down your rules, such as adding node_modules/; Open the command line window, switch to the root directory (you can directly enter CMD in the address bar above the folder); Run ren gitignore.txt. gitignore. Git Bash Here Enter the vim. gitignore command to open the file (no file will be created automatically); Press I to switch to the editing mode, enter a rule, such as node_modules/, then press Esc to exit the editing mode, and enter :wq to save and exit.Copy the code
5. Command line
Git init generates local git management in the current project directory.
Git add. adds all the files on your project to the repository. If you want to add a specific file, just add git add. Just use this particular file name.
Warning: LF will be replaced by CRLFin. The file will have its original line endingsinGit config --global core. Autocrat (cascadefalseCause: There is a sign escape problem with/in the path.falseYou don't convert symbols by defaulttrue, which is equivalent to escaping the/symbol of the path, thus causing problems when addingCopy the code
Git commit -m “first commit
6. Associate your Github account and create an SSH KEY
After the commit, you may be prompted to associate with your account, as shown in the picture below. Perform steps 6 and 7
(A) Configure the global name and email, here is your Github name and email
git config --global user.name "XXX"
git config --global user.email "[email protected]"
Copy the code
(B) ssh-keygen -t rsa-c “Your email”
ssh-keygen -t rsa -C "[email protected]"
Copy the code
Then press Enter and you’ll find id_rsa and id_rsa.pub in the.ssh directory under the user
7. Go back to Github and add the SSH key
Click Settings, select SSH and GPG KEYS, click the New SSH key in the upper right corner, fill in the Title, and copy the contents of id_rsa.pub under the.ssh folder into the key content box under the Title. Finally, click Add SSH Key to complete SSH key encryption. Specific steps:Copy the code
Enter Git remote add Originhttps:// Url address of your repository, associate the local repository with Github,
9. Upload code to github repository
git push -u origin master
Copy the code
When you’re done, wait a few seconds, then a screen pops up asking you to enter your Username and Password. All you have to do is enter your Github login account and Password.
Remote: Invalid username or password. May be the user name and password input error, we carefully input goodCopy the code
Git git
- git clone url
- Git clone -b XXX url
- Git log // View commit history
- Git add README hello.php // you can add a single file directly
- git add .
- Git commit -m
- git pull
- git push
- Git branch branchName
- Git checkout branch
- Git status // Check git status
- Git diff // view changes made after saving and before adding
- Git diff –cached // View changes made after add and before commit
- Git commit -am ‘change hello. PHP
Version back
After saving locally
- Git checkout. // This is the retracted operation before adding the modification after saving it.
Git add
- Git reset HEAD. //
Git commit -m”
- Git reset –soft HEAD^ or git reset HEAD^
- Git reset –hard HEAD^ // Go back to the previous version and the code is the same as the previous version
- git reset –hard 78d43244f90bf30e3ec5554d9042d06bd34df6a2// Rollback specifiedversion
- Git reflog // Back to the future
Git commit to GitHub
Git Remote add Origin github.com/xaioadi666/…
git push -u origin master