#下载安装git
#在gitee创建一个空项目
#在本地项目目录右击,打开gitee Bash here
#初始化本地仓库
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master
$ git init
#设置用户名
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master
$ git config user.name “@jia****0329”
#设置邮箱地址
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master
$ git config user.email “邮箱”
#获取ssh密钥,
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master
$ ssh-keygen -t ed25519 -C “邮箱”
Generating public/private ed25519 key pair.
Enter file in which to save the key (/c/Users/17709/.ssh/id_ed25519):
Created directory '/c/Users/17709/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/17709/.ssh/id_ed25519
##打开id_ed25519.pub,复制里面的密钥,粘贴到gitee页面—个人——设置——ssh公钥——公钥
Your public key has been saved in /c/Users/17709/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:mhW+MEN3SIGts1iPnYFeriyobVxRW63UnRcMTLkJ4Ns “1770******@qq.com”
The key's randomart image is:
+--[ED25519 256]--+
| o+= +o=.. |
| oo+.+ = o |
| ..*=... + |
| ..*o+= o |
| =+OSoE |
| o +B=. |
| . o .o.. |
| .+ . o |
|.o. . |
+----[SHA256]-----+
# 上传到远程仓库
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master (master)
$ git remote add origin https://gitee.com/jiangfan0329/my_first_project.git
# 将远程origin主机的master分支拉取过来和本地的当前分支进行合并
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master (master)
$ git pull origin master
fatal: couldn't find remote ref master
# 将当前目录下修改的所有代码从工作区添加到暂存区 . 代表当前目录
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master (master)
$ git add .
warning: in the working copy of '.babelrc', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.editorconfig', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it
......
# 添加一个描述
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master (master)
$ git commit -m '1.0'
[master (root-commit) 75c2131] 1.0
92 files changed, 8250 insertions(+)
create mode 100644 .babelrc
create mode 100644 .editorconfig
create mode 100644 .gitignore
....
# 将本地版本库推送到远程服务器
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master (master)
$ git push origin master
Enumerating objects: 107, done.
Counting objects: 100% (107/107), done.
....
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/vueproject-master (master)
$ cd ..
# 将gitee的代码来到本地
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project (master)
$ git clone https://gitee.com/jiangfan0329/my_first_project.git
Cloning into 'my_first_project'...
remote: Enumerating objects: 107, done.
remote: Counting objects: 100% (107/107), done.
# 进入拉下来的项目文件夹
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project (master)
$ cd my_first_project/
# 更新一下git
17709@DESKTOP-G9TCMQH MINGW64 /f/JJL_Temp/Java/My_Project/my_first_project (master)
$ git pull
Already up to date.
将本地项目上传到gitee,并将gitee的项目保存到本地
于 2023-01-02 23:34:59 首次发布