01.Git安装(略)
02.设置全局Git信息
设置全局系统信息
git config --global user.name "用户名"
git config --global user.email 10086@qq.com
查看配置
git config --system --list
git config --global --list
查看当前用户(global)配置
$ git config --global --list
user.name=用户名
user.email=10086@qq.com
查看系统config
32008@LAPTOP-0R935I6E MINGW64 /e/javacodes/project/bank-seckill (master)
$ git config --system --list
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=E:/java/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
core.editor=nano.exe
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
03.Git绑定Gitee
登录Gitee并登录注册
https://gitee.com/
生成SSH公钥
进入目录:C:\Users\32008
进入.ssh目录,若没有则创建一个
生成密钥
ssh-keygen -t rsa
具体如下:
32008@LAPTOP-0R935I6E MINGW64 ~/.ssh
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/32008/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/32008/.ssh/id_rsa
Your public key has been saved in /c/Users/32008/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:w81p62QBkCJTGxB23EFjKNNnP34/2uyHfHNgL0cQ6kE 32008@LAPTOP-0R935I6E
The key's randomart image is:
+---[RSA 3072]----+
| +*++*o |
| .=.=+=o E . |
| =.+ .. . . . |
| .o+ .o . |
| .S.*. . . |
| .o.o. o .|
| .+o o + |
| + o= = +|
| oo++ = |
+----[SHA256]-----+
32008@LAPTOP-0R935I6E MINGW64 ~/.ssh
密钥生成后
配置Gitee免密码登录
注册后登录gitee点击设置,然后点击ssh公钥
将id_rsa.pub(公钥)复制到公钥中
配置完成
检查是否配置成功
$ ssh -T git@gitee.com
具体结果
32008@LAPTOP-0R935I6E MINGW64 ~/.ssh
$ ssh -T git@gitee.com
The authenticity of host 'gitee.com (212.64.62.183)' can't be established.
ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes #这里要输入yes
Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts.
Hi mhzzj! You've successfully authenticated, but GITEE.COM does not provide shell access.
04.推送到远程库
4.1推送流程
4.2提交本地仓库
原本项目如下
初始化项目,输入命令:git init
32008@LAPTOP-0R935I6E MINGW64 /e/javacodes/project/bank-seckill
$ git init
Initialized empty Git repository in E:/javacodes/project/bank-seckill/.git/
初始化后的项目
查看初始化情况输入git status
32008@LAPTOP-0R935I6E MINGW64 /e/javacodes/project/bank-seckill (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/
pom.xml
seckill-common/
seckill-service/
src/
nothing added to commit but untracked files present (use "git add" to track)
添加到暂停区
git add [file name]
git add .
输入git status,具体如下
提交到本地仓库
$ git commit -m "本次提交的描述"
4.3提交远程库
创建远程仓库
后面可以修改为公开
创建成功标志
提交远程仓库
链接远程仓库
git remote add <起源> <仓库路径>
具体操作如下:
32008@LAPTOP-0R935I6E MINGW64 /e/javacodes/project/bank-seckill (master)
$ git remote add origin git@gitee.com:mhz-zzj/bank-seckill.git
推送到远程仓库 :git push -u origin "master"
32008@LAPTOP-0R935I6E MINGW64 /e/javacodes/project/bank-seckill (master)
$ git push -u origin "master"
Enumerating objects: 140, done.
Counting objects: 100% (140/140), done.
Delta compression using up to 8 threads
Compressing objects: 100% (119/119), done.
Writing objects: 100% (140/140), 36.67 KiB | 2.82 MiB/s, done.
Total 140 (delta 52), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (52/52), done.
remote: Powered by GITEE.COM [GNK-6.3]
To gitee.com:mhz-zzj/bank-seckill.git
* [new branch] master -> master
branch 'master' set up to track 'origin/master'.
推送成功
|