This is the sixth day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021.

Local Git is bound to Github

First you need to install Git and register your Github account

  1. To generate a public key

At any point, git bash, type the following command

 ssh-keygen -t rsa -b 4096 -C "Sign up for github email"
Copy the code
Generating public/private rsa key pair.
Enter file inWhich to save the key (c/Users/Administrator /. SSH/id_rsa) : "enter save the key file name, can directly enter"Copy the code
Enter passphrase (empty forNo passphrase): Enter the same passphrase again:Copy the code
Your public key has been saved inId_rsa.pub. The key fingerprint is: SHA256: NCYQZN5 + D4HI9ZhuILjwiSJVo4t4ZEIjVZUznjWqbQE... .Copy the code

You also get two files in the folder git bash opened

  1. Copy the public key

In git bash just now

$ clip < ~/.ssh/id_rsa.pub
Copy the code
  1. Set the sshkey

Go to your Github homepage and click Settings in the top right corner of your profile picture to find SSH and GPR Keys The value of title can be customized, and the value of key can be directly pasted. We have used the clip command to copy

Now that the binding is complete, you can clone the project directly from the SSH address

Git ignores updating specified files

Methods a

By modifying the. Gitignore file

  1. Open the project obtained with the git clone command

2. Open the. Gitignore file

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME).mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar# add file () # add file (Copy the code

Configuration syntax: Indicates a directory with a slash (/). Wildcard multiple characters with asterisk “*”; With a question mark “?” Wildcard Single character contains the matching list of single characters in square brackets []. With exclamation “!” It does not ignore (trace) matched files or directories.

Way 2

Using commands to do this only ignores files and is not commonly used

  1. Open the project obtained with the git clone command
  2. Type the command
git update-index --assume-unchangedThe file nameCopy the code
  1. Cancel to ignore
git update-index --no-assume-unchangedThe file nameCopy the code