1.创建仓库
2.上传代码:
(1)在项目的根目录,初始化新版本库
git init
(2)在根目录创建.gitignore文件,设置要忽略的文件或文件夹
vi .gitignore
(3)在.gitignore文件中写入要忽略的文件或文件夹,例如:
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
# Android Studio
*.iml
.idea
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
.gradle
build/
build-outputs
out/
/*/*/build
/*/*/production
*.iws
*.ipr
*~
*.swp
*.trace
*.[ao]
*.log
captures/
.vscode/
freeline.py
freeline/
freeline_core/
freeline.zip
/CtripMain/src/ctrip/business/controller/MyTourApp.java
freeline_project_description.json
(4)添加新文件到版本库
git add .
(5)提交
git commit-m "message"
(6)添加远程仓库的别名:git remote add <别名> <远程仓库的URL>,例如:
git remote add origin https://github.com/johngef/test2.git
(7)推送到远程库:
git push -u origin master