2.项目初始化

2020-05-18  本文已影响0人  惜小八

转载自:https://www.jianshu.com/p/e8485a712c63

一、新建项目

1、新建Maven项目

image

2、填写相关参数 接着下一步就行

image

3、博主发现在新建玩Maven项目时候少了一些文件夹,
比如resource
于是采用下面步骤新建

image

点击 Project Structure...

image

点击左侧Modules 然后在main上面新建resource文件夹并且设置为Resources

image

然后在文件夹下直接新建比如java 、test 等文件夹就行。
4、配置Tomcat运行项目

image

点击Run 接着点击Edit Configurations...

image image image image image

二、将项目提交到码云

在码云创建好一个仓库,SSH地址为:git@gitee.com:superzqbo/mmall_learning.git

在本地进行git初始化的时候遇到了一些问题,根据提示对问题进行解决,最后成功提交至gitee,具体操作如下:
大体步揍如下;
1. git init
2. git add .
3. git commit -am 'mmall_learning init'
4. git remote add origin git@gitee.com:superzqbo/mmall_learning.git
5. git push -u origin master           git push -u -f origin master(是强制推送)

以后在进行提交时直接使用2,3,5即可

创建分支:
1. git checkout -b v1.0 origin/master
2. git push origin HEAD -u
➜  mmall_learning git init
Initialized empty Git repository in /Users/codesheep/ideaworkspace/mmall_learning/.git/
➜  mmall_learning git:(master) ✗ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." 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)
➜  mmall_learning git:(master) ✗ git add .
➜  mmall_learning git:(master) ✗ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." 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

➜  mmall_learning git:(master) ✗ git commit -am 'mmall_learning init'
[master (root-commit) ed243a3] mmall_learning init
 5 files changed, 150 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
➜  mmall_learning git:(master) git remote add origin git@gitee.com:superzqbo/mmall_learning.git
➜  mmall_learning git:(master) git branch

➜  mmall_learning git:(master) git push -u origin master
To gitee.com:superzqbo/mmall_learning.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@gitee.com:superzqbo/mmall_learning.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.
➜  mmall_learning git:(master) git pull
warning: no common commits
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From gitee.com:superzqbo/mmall_learning
 * [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

➜  mmall_learning git:(master) git push -u origin master
To gitee.com:superzqbo/mmall_learning.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:superzqbo/mmall_learning.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
➜  mmall_learning git:(master) git push -u -f origin master
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 2.12 KiB | 2.12 MiB/s, done.
Total 11 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-5.0]
To gitee.com:superzqbo/mmall_learning.git
 + cec4bb7...ed243a3 master -> master (forced update)
Branch 'master' set up to track remote branch 'master' from 'origin'.
image image image
上一篇 下一篇

猜你喜欢

热点阅读