Getting started with gitee
Reference website:
https://mp.weixin.qq.com/s/taKtlOGSQKjVBJUMRJzNng
git basic command
http://www.shaoming.club/archives/git%E5%91%BD%E4%BB%A4%E6%95%B4%E7%90%86md
explain
I wanted to sort out the process of gitee uploading code before. Later, I happened to see this article because I didn't have time to sort it out. This article introduces the process of gitee getting started and uploading code in detail. This article is worth reading and collecting
1. Registered account
Open web page
https://gitee.com/
Click Register, enter a domain name you like, and yikoulinux enter your mobile phone number to verify
Click Register and bind.
2. Bind wechat
Click Avatar - > SettingsThen the QR code will pop up, and you can scan the QR code with your own wechat.
2. Bind mailbox
Subsequent version management operations need to bind the mailbox to continue.
Click Avatar - > Settings
Click mailbox management - > add on the left, and then enter the gitee login password just set
Correctly enter the following page and enter your own email (QQ email used by you)
Click OK
Then log in to your email and click the corresponding link.
3. New warehouse
Click + - > new warehouse on the left of the avatar
Enter the name, open source license, etc.Click create.
4. clone warehouse to local
Copy warehouse link:
Enter ubuntu. If git is not installed, you can execute the following command to install git
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 open text editing tool of 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 encryption root@ubuntu:/home/peng/work# cd encryption/ root@ubuntu:/home/peng/work/encryption# ls LICENSE
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 at this time]
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.
@qq.com' -t rsa
In the user directory`~/.ssh/`Create the corresponding key file under. If an administrator creates a directory`/root/.ssh/`Down. ### (2) Upload public key Use command`cd ~/.ssh get into~/.ssh`Folders, entering
cat id_rsa.pub
open id_rsa.pub File and copy everything in it. Then visit git Web page, click SSH The public key can be entered freely in the title bar, and the public key bar pastes the content just copied. ![picture](https://img-blog.csdnimg.cn/img_convert/fb8d0a80316da31df24018aeddd56321.png)