Install Git

To use Gitee, you need to install git tools. Git tool download: git-scm.com/downloads

After the installation is complete, enter git –version on the cli to view the Git version.

Right-click the menu will also appear the corresponding menu.

2. Log in to Gitee

We first registered our account on Gitee and logged in. Gitee website: gitee.com/

Generate an SSH public key

Since the transport between our local Git repository and gitee repository is encrypted via SSH, we need to configure the SSH public key.

Note: With git tools installed, you can use SSH commands

Open the CMD command-line interface (CLI) and enter the command

ssh-keygen -t rsa -C "[email protected]"
Copy the code

Note: [email protected] is just the name of the generated sshkey and does not constrain or require a specific mailbox to be named.

Press Enter three times as prompted to generate an SSH key. As you can see, we generated the public key file id_rsa.pub path: C:\Users\A/. SSH /id_rsa.pub enter the directory with A text editor open

You see the SSH public key, which will be used later.

Configure the SSH public key

Click Settings on the Gitee website

Click SSH Public key to enter the public key title, copy the SSH public key to the box, and click OK

Configuration is successful

Create a project

Click the + sign in the upper right corner to create a new warehouse



Fill in the warehouse information as follows, and click Create.

Clone the warehouse to the local

Click Clone/Download, and then SSH to copy the Git link

Next, right-click on the local directory blank menu and click Git Bash Here.

Enter the git link from git Clone as shown below

git clone [email protected]:linxinfa/mytest.git
Copy the code

After success, the cloned README file is displayed in the local directory.

7. Associate local project to remote warehouse

In some cases, we may have the project files locally and then create the repository on Gitee. At this point, you can associate it with Gitee’s remote library using the git remote add command on the local library, as shown below

git remote add origin [email protected]:linxinfa/mytest.git
Copy the code

Git remote add = “git remote add”

git remote add origin [email protected]:linxinfa/mytest.git
fatal: remote origin already exists.
Copy the code

Git remote -v: git remote -v: git remote -v: git remote -v: git remote -v: git remote

git remote -v
origin [email protected]:linxinfa/mytest.git (fetch)
origin [email protected]:linxinfa/mytest.git (push)
Copy the code

We can delete existing remote libraries

git remote rm origin
Copy the code

Then associate the remote library

git remote add origin [email protected]:linxinfa/mytest.git
Copy the code

Add files

To add files locally, add an addFiletest.txt file as follows.

Execute git command to commit the file

Open git and run git add, commit and push commands to upload local files to the remote repository.

Note: The common git commands are shown at the end of this article.

Refresh the Gitee page to see that the local file has been uploaded to Gitee

Delete the warehouse

Click on the management

Click to delete the warehouse, according to the prompts to enter the password

Common Git commands

Common Git commands

Git add -A = "git rm test.txt" git add -A = "git rm test.txt" git add -A = "git rm test.txt" git add -A = "git rm test.txt" Git reset --hard HEAD^ # Update git reset --hard HEAD^ # update git reset Reset --hard HEAD^^ # Rollback of two versions git reset --hard HEAD~100 # Rollback of multiple versions git remote add Origin + address # commit to remote repository (second and later)Copy the code





More and moregitCommand can be enteredgit --helpView, or accessgitCommand manual:git-scm.com/docs

git --help usage: git [--version] [--help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]  [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink restore Restore working tree files rm Remove files from the working tree and from the index sparse-checkout  Initialize and modify the sparse-checkout examine the history and state (see also: git help revisions) bisect Use binary search to find the commit that introduced a bug diff Show changes between commits,  commit and working tree, etc grep Print lines matching a pattern log Show commit logs show Show various types of objects status Show the working tree status grow, mark and tweak your common history branch List, create, or delete branches commit Record changes to the repository merge Join two or more development histories together rebase Reapply commits on top of another base tip reset Reset current HEAD to the specified state switch Switch branches tag Create, list, delete or verify a tag object signed with GPG collaborate (see also: git help workflows) fetch Download objects and refs from another repository pull Fetch from and integrate with another repository or a local branch push Update remote refs along with associated objects 'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific  subcommand or concept. See 'git help git' for an overview of the system.Copy the code

Thank the bosses share this article, the article comes from blog.csdn.net/linxinfa/ar…