“上传JAVA项目代码到Git仓库(本地版)”的版本间的差异
来自CloudWiki
(创建页面,内容为“==准备工作== 建立一个本地Git仓库: *Linux系统部署Git仓库 ==客户端== 普通Git节点即是客户端 ===编写项目代码=== 这里我们…”) |
(→向代码库提交新版本) |
||
(未显示4个用户的5个中间版本) | |||
第5行: | 第5行: | ||
普通Git节点即是客户端 | 普通Git节点即是客户端 | ||
− | === | + | ==新建仓库== |
− | |||
− | + | [git@localhost ~]$ mkdir a | |
− | git | + | [git@localhost ~]$ cd a |
+ | |||
+ | [git@localhost a]$ mkdir solo.git | ||
+ | |||
+ | [git@localhost a]$ cd solo.git/ | ||
+ | |||
+ | [git@localhost solo.git]$ git --bare init | ||
+ | |||
+ | 初始化空的 Git 版本库于 /home/git/a/solo.git/ | ||
===更改推送地址=== | ===更改推送地址=== | ||
− | cd solo | + | cd /solo |
移除旧的推送地址,添加新的: | 移除旧的推送地址,添加新的: | ||
第25行: | 第32行: | ||
提交代码到Git仓库并创建tag: | 提交代码到Git仓库并创建tag: | ||
− | touch | + | cd |
+ | |||
+ | touch solo.git/a.html | ||
+ | |||
+ | cd /solo | ||
git add . | git add . | ||
+ | |||
+ | git config --global user.email "you@example.com" | ||
+ | |||
+ | git config --global user.name "Your Name" | ||
+ | |||
git commit -m “a” | git commit -m “a” |
2019年5月28日 (二) 10:38的最新版本
准备工作
建立一个本地Git仓库:
客户端
普通Git节点即是客户端
新建仓库
[git@localhost ~]$ mkdir a
[git@localhost ~]$ cd a
[git@localhost a]$ mkdir solo.git
[git@localhost a]$ cd solo.git/
[git@localhost solo.git]$ git --bare init
初始化空的 Git 版本库于 /home/git/a/solo.git/
更改推送地址
cd /solo
移除旧的推送地址,添加新的:
git remote remove origin
git remote add origin git@10.0.0.30:/home/git/solo.git
向代码库提交新版本
提交代码到Git仓库并创建tag:
cd
touch solo.git/a.html
cd /solo
git add .
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git commit -m “a”
创建标签:
git tag 1.0.0
推送到Git服务器:
git push origin 1.0.0