关于javaWeb项目的初始化工作

1、数据库初始化,创建一些表结构
2、JDK、Maven配置:
IDEA中:Configure/Project Default下的Setting和Project Structure配置jdk和maven
3、创建新项目:New Project–》Maven—》点击create from archetype和jdk,找到webapp的原型。=》等待
4、配置Tomcat:选择启动键旁边的Edit…,选择Tomcat,选择Local,命名,配置server(添加),端口8088,,Deployment中选择+ artifact…,选择war选项会把直接发送到Tomcat目录下面。=》启动Tomcat
5、git初始化仓库:
在git上新建项目
在项目中初始化git:
$ touch README.md 首先创建这个文件
$ touch .gitignore 很关键,能把匹配上的文件给忽略,不会推送
gitinitInitializedemptyGitrepositoryin/home/hanlin/developer/Code/idea/mmall/.git/ g i t i n i t 初 始 化 重 点 内 容 I n i t i a l i z e d e m p t y G i t r e p o s i t o r y i n / h o m e / h a n l i n / d e v e l o p e r / C o d e / i d e a / m m a l l / . g i t / git status
On branch master

Initial commit

Untracked files:
(use “git add …” to include in what will be committed)

    .gitignore
    README.md
    pom.xml
    src/

nothing added to commit but untracked files present (use “git add” to track)
$ git add . 添加所有变更文件
$ git status
On branch master

Initial commit

Changes to be committed:
(use “git rm –cached …” to unstage)

    new file:   .gitignore
    new file:   README.md
    new file:   pom.xml
    new file:   src/main/webapp/WEB-INF/web.xml
    new file:   src/main/webapp/index.jsp

$ git commit -am ‘first commit init project’
[master (root-commit) 6e45e83] first commit init project
Committer: CentOS6.8 hanlin@www.imooc.com
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

git config --global --edit

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

5 files changed, 114 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 pom.xml
create mode 100644 src/main/webapp/WEB-INF/web.xml
create mode 100644 src/main/webapp/index.jsp
$ git remote add origin git@gitee.com:aeiou245192766/immooccode.git连接远程仓库
$ git branch 查看分支
* master
$ git push -u origin master 把本地推送到master上
The authenticity of host ‘gitee.com (116.211.167.14)’ can’t be established.
RSA key fingerprint is e3:ee:82:78:fb:c0:ca:24:65:69:ba:bc:47:24:6f:d4.
Are you sure you want to continue connecting (yes/no)? t
Please type ‘yes’ or ‘no’: yes
Warning: Permanently added ‘gitee.com,116.211.167.14’ (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

还没有配秘钥
去ssh-kegen。。。。配好秘钥,继续

$ git push -u origin master 再次把本地推送到master上
To git@gitee.com:aeiou245192766/immooccode.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘git@gitee.com:aeiou245192766/immooccode.git’
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.
报错说:你可能想第一次整合,在push之前先执行以下git pull
$ git pull
warning: no common commits
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From gitee.com:aeiou245192766/immooccode
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

$ git push -u -f origin master 强推了(-f,其实不用)
Counting objects: 11, done.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (11/11), 1.63 KiB | 0 bytes/s, done.
Total 11 (delta 0), reused 0 (delta 0)
remote: Powered by Gitee.com
To git@gitee.com:aeiou245192766/immooccode.git
+ 9e2e0ab…6e45e83 master -> master (forced update)
Branch master set up to track remote branch master from origin.

初始化完成,查看分支
$ git branch
* master
$ git branch -r
origin/master
$ git checkout -b v1.0 origin/master创建一个v1。0的分支,并切换
Branch v1.0 set up to track remote branch master from origin.
Switched to a new branch ‘v1.0’
$ git branch//查看当前分支
master
* v1.0
把当前分支推送到远程
$ git push origin HEAD -u
Total 0 (delta 0), reused 0 (delta 0)
remote: Powered by Gitee.com
To git@gitee.com:aeiou245192766/immooccode.git
* [new branch] HEAD -> v1.0
Branch v1.0 set up to track remote branch v1.0 from origin.
结束!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值