使用git创建仓库,并上传代码
2016-12-14 00:00
393 查看
1.创建仓库
![](https://static.oschina.net/uploads/space/2016/1214/112113_SSiT_2270118.png)
2.上传代码:
(1)在项目的根目录,初始化新版本库
(2)在根目录创建.gitignore文件,设置要忽略的文件或文件夹
(3)在.gitignore文件中写入要忽略的文件或文件夹,例如:
(4)添加新文件到版本库
(5)提交
(6)添加远程仓库的别名:git remote add <别名> <远程仓库的URL>,例如:
![](https://static.oschina.net/uploads/space/2016/1214/112113_SSiT_2270118.png)
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 远程仓库创建和代码上传
- git创建远程仓库并上传代码到远程仓库中
- 使用 Git上传代码到远程代码仓库详解
- 如何使用git将代码上传至码云远程仓库
- git 的使用——基本的仓库创建,文件提交,上传操作命令,远程仓库关联
- 第一次使用GIT,创建仓库并提交项目代码
- 使用git从本地上传代码到码云远程仓库
- 第一次使用GIT,创建仓库并提交项目代码
- Github:在eclipse中使用git clone 别人共享在Github的代码和上传到自己的仓库!
- 【git】创建一个新的本地仓库并上传代码
- 使用Git上传代码到Github仓库
- 使用git工具提交上传代码到GitHub上或者远程仓库
- Mac下使用Git上传代码到Github仓库
- 【git】创建一个新的本地仓库并上传代码(整理)
- 使用gitbash上传代码到github远程仓库简单教程
- 用git 命令创建本地仓库将本地代码上传到github
- 使用IO技术,创建一个目录,然后复制一个文件到该目录!实现复制的功能。(在博客园上传的第一份代码)
- 使用Git命令从Github下载代码仓库
- 如何使用Git上传项目代码到github