一、在码云上创建项目名称为demo的项目
入口如下图中所示,按照向导进行即可。
二、打开GitBash ,用cd命令进入本地项目目,然后把初始化一下,把本地的目录变成git本地仓库,
oda-l@MSI MINGW64 /d/javaprojet/oda-base
$ git init
Initialized empty Git repository in D:/javaprojet/oda-base/.git/
git status 可以查看本地目录的状态信息
oda-l@MSI MINGW64 /d/javaprojet/oda-base (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
三、将你本地仓库与码云上的远程仓库关联起来
oda-l@MSI MINGW64 /d/javaprojet/oda-base (master)
$ git remote add origiin https://gitee.com/abreolee/oda-base.git
四、在你准备上传你的项目之前,最好更新一下项目,确保没有和远程仓库的代码有冲突
oda-l@MSI MINGW64 /d/javaprojet/oda-base (master)
$ git pull --rebase origin master
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
From https://gitee.com/abreolee/oda-base
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
五、把你的项目复制到这个目录下,用命令添加你要上传的项目,再提交到本地暂存区,最后把本地仓库项目提交到远程仓库。
git 是强烈建议你在提交代码的时候,要写备注注释的,所以既然人家是强烈建议,你就别懒了。 $ git add . 添加目录下所有发生改变的文件(如:git add --all)
oda-l@MSI MINGW64 /d/javaprojet/oda-base (master)
$ git add --all
warning: LF will be replaced by CRLF in project/bin/pom.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in project/bin/target/classes/rebel.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in project/pom.xml.
The file will have its original line endings in your working directory
$ git commit -m '注释信息'
oda-l@MSI MINGW64 /d/javaprojet/oda-base (master)
$ git commit -m"init"
[master fdcf082] init
24 files changed, 2207 insertions(+)
create mode 100644 project/.classpath
create mode 100644 project/.project
create mode 100644 project/.settings/org.eclipse.jdt.core.prefs
create mode 100644 project/bin/.settings/org.eclipse.core.resources.prefs
create mode 100644 project/bin/pom.xml
$ git push -u origin master 本地仓库代码提交至远程仓库
oda-l@MSI MINGW64 /d/javaprojet/oda-base (master)
$ git push -u origin master
Enumerating objects: 60, done.
Counting objects: 100% (60/60), done.
Delta compression using up to 12 threads
Compressing objects: 100% (34/34), done.
Writing objects: 100% (59/59), 30.40 MiB | 3.24 MiB/s, done.
Total 59 (delta 6), reused 0 (delta 0)
remote: Powered By Gitee.com
To https://gitee.com/abreolee/oda-base.git
abbc92c..fdcf082 master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
六、新建一个目录,从码云上把上传的代码下载下来:来检验是否已经上传成功
$ git clone https://gitee.com/xxxxx/oda-base.git