Git installation and basic operation

First install git, the official website to download https://git-scm.com/, choose your own version

The second step, the registration code or GitHub cloud, the cloud code: https: //gitee.com/,GitHub: https: //github.com/

A third step, the user configuration information

git config --global user.email "[email protected]"
git config --global user.name "Your Na

Which quotes to fill in their own information

Fourth, to find a file path, cd .. is the parent directory, cd into the directory, mkdir create a new directory

 

 After the new directory, you will see your folder

Then initialize the local repository git init

 

 

 

 You can now see the folder with git file. It is the local warehouse, and then just add a text file. Then enter git add.

At this point it will be changes to the file (added file) added to the staging area. Input git status can be viewed, as in FIG.

Use git commit -m "Remarks" confirm the formation of a local version, which is submitted to the local repository.

At this time, git log commit record can be seen

Use git reset --hard x fall back to a local version, x is seven git log before appearing in numbers, it can be all of them.

 

 The fourth step is to configure the public key

Because you want to submit to a remote repository, so it is necessary to establish a connection, if you do not configure the public key, then it has been required to enter a password, too much trouble.

In the input git ssh-keygen -t rsa -C "[email protected]" generated secret key, Enter three, first, confirms that ssh save directory, the disc is generally in c -> User -> Administrator (current user files folder, this might not see their situation) -.. ssh will see a pub file in this folder to open, copy with Notepad.

 

 

 

 

Then log gitee or GitHub, find a setting to find ssh.

 

 

 

 As shown above, are copied GitHub and gitee will just get the public into the text box, click OK, and then configured.

Use ssh [email protected] can check whether the configuration. Connection gitee public key, and if a company address, need to be replaced gitee.com

Then, create a new warehouse in the cloud code.

 

 use

$ git remote add origin [email protected]:rjj1/h2.git

The local repository associated with the remote repository.

Use the pull command, the remote repository to pull local

$ git pull --rebase origin master

Guess you like

Origin www.cnblogs.com/tomato190/p/12523548.html