您的位置:首页 > 编程语言

使用git创建仓库,并上传代码

2016-12-14 00:00 393 查看
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[/code] (7)推送到远程库:

git push -u origin master
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git 上传代码