Teach you how to upload code to gitee server

I have written several small projects for novices,
In order to facilitate everyone to learn and download the code,
Decided to upload the code to the gitee server.

It has to be said that git is a very easy-to-use code version management tool,

This article teaches you how to upload your own code to Gitee.

1. Registered account

Open web page


Click Register,
Enter a domain name you like, yikoulinux
Enter the mobile phone number and verify it

Click Register and bind.

2. Bind wechat

Click Avatar - > Settings

Then the QR code will pop up,
Just scan the QR code with your own wechat.

2. Bind mailbox

Subsequent version management operations need to bind mailboxes to continue.

Click Avatar - > Settings

Click mailbox management - > add on the left
Then enter the gitee login password you just set

Correctly enter the following page and enter your own email (QQ email used by you)

Click OK

Then log in to your mailbox and click the corresponding link.

3. New warehouse

Click + - > new warehouse on the left of the avatar

Enter a name, open source license, etc.
Click create.

4. clone warehouse to local

Copy warehouse link:

Enter ubuntu
If Git is not installed, you can install git by executing the following command

sudo apt-get install git

Configure git global environment

git config --global user.name "yikoulinux"
git config --global user.email "7335817@qq.com"

Modify the default text editing tool opened by commit

git config --global core.editor "vim"

Start cloning:

root@ubuntu:/home/peng/work# git clone https://gitee.com/yikoulinux/encryption.git
Cloning into 'encryption'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
Checking connectivity... done.

View cloned folders

root@ubuntu:/home/peng/work# ls
root@ubuntu:/home/peng/work# cd encryption/
root@ubuntu:/home/peng/work/encryption# ls

View git log

root@ubuntu:/home/peng/work/encryption# git log
commit 5e0d6d12afb34a8082c6ef60f34f6e615c99746e
Author: a bite Linux <10221187+yikoulinux@user.noreply.gitee.com>
Date:   Tue Dec 21 13:57:19 2021 +0000

    Initial commit

Copy code to current directory

root@ubuntu:/home/peng/work/encryption# ls
key.c  key.h  LICENSE  main.c  README.md   

Readme MD is a document description written in Markdown format.

Add source file to local warehouse:

root@ubuntu:/home/peng/work/encryption# git add *
root@ubuntu:/home/peng/work/encryption# git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   LICENSE
	new file:   README.md
	new file:   key.c
	new file:   key.h
	new file:   main.c
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   .gitignore

Execute commit

root@ubuntu:/home/peng/work/encryption# git commit

Add the log information of the commit [the editing tool is vim]

Upload to server:

root@ubuntu:/home/peng/work/encryption# git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://gitee.com': yikoulinux
Password for 'https://yikoulinux@gitee.com': 
Counting objects: 6, done.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 2.28 KiB | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.2]
To https://gitee.com/yikoulinux/encryption.git
   5e0d6d1..484d5d4  master -> master

The user name (the name yikoulinux set at the beginning) and password will be required, and will not be echoed when entering the password.

Finally, the results are displayed on gitee:

In this way, we will successfully upload the local code to the server.

5. Common git commands

git clone Project address pull project
git pull    Pull code
git push  Submit to warehouse
git init Instruction initializes a git Warehouse
git add .Add file
git commit -m "notes"Submit to warehouse.
git remote add origin https://git.oschina.net / your user name / project name
git,git push origin master Push can be completed
git checkout master   Switch to master branch

6. If you don't want to enter the user name and password every time, you can

(1) Generate ssh key

ssh-keygen -C '7335817@qq.com' -t rsa

In the user directory ~ / Establish the corresponding key file under ssh /.
If you are an administrator, create it in the directory / root / SSH / next.

(2) Upload public key

Use the command Cd ~ / ssh enters ~ / ssh folder, enter

cat id_rsa.pub

Open id_rsa.pub file and copy all the contents. Then visit the git web page and click the SSH public key. The title bar can be entered at will. The public key bar pastes the content just copied.

In addition, yikoujun also created an open source project of chat room based on Linux,
The basic functions include login, registration, public chat, private chat, database, data encryption and other functions.
Other functions will be improved in the future.


Finally, welcome to my open source project!

Thank you!

Keywords: Linux gitee

Added by starter911 on Mon, 10 Jan 2022 13:23:36 +0200