第一步: 先去开源中国创建一个项目,然后得到项目链接,这时候项目里面是空的,只有一个Readme文件 android studio oscGit使用

第二步: 1,打开Android Studio,新建一个Android Studio项目,一路Next(假如项目是刚开始开发的话), 2,点击VCS 选择第二个 然后选择git ,此时我们的项目已经变成了一个git项目

android studio oscGit使用

android studio oscGit使用

android studio oscGit使用 3,将git项目add一下 然后commit 一下! 4,在命令行或者cmd下面输入git 命令 将本地的git项目关联到网络上的git服务器,这个地址就是我们创建项目时生成的那个地址 git remote add origin https://git.oschina.net/........git

android studio oscGit使用 5,假如已经成功安装.ignore的插件的话,当我们新建项目时就会生成一个.gitignore的文件,很明显你要先去安装.ignore的插件不然 没法帮你忽略不该上传的东西,安装插件的方法非常简单,自己百度

android studio oscGit使用

gitignore的文件如下:

OSX

*.DS_Store

Gradle files

build/ .gradle/ */build/

IDEA

*.iml .idea/.name .idea/encodings.xml .idea/inspectionProfiles/Project_Default.xml .idea/inspectionProfiles/profiles_settings.xml .idea/misc.xml .idea/modules.xml .idea/scopes/scope_settings.xml .idea/vcs.xml .idea/workspace.xml .idea/libraries

Built application files

Files for the Dalvik VM

*.dex

Java class files

*.class

Generated files

antLauncher/bin antLauncher/gen

Local configuration file (sdk path, etc)

local.properties

Log Files

*.log

generated files

bin/ gen/

Eclipse project files

.classpath .project

Proguard folder generated by Eclipse

proguard/

Intellij project files

*.ipr *.iws .idea/

下面摘抄自别人: 创建完上面的过滤文件后 需要执行以下方法才能生效:

改动过.gitignore文件之后,在repo的根目录下运行: git rm -r --cached . git add . 之后可以进行提交: git commit -m "fixed untracked files" 如果执行上面方法不能生效,并且在创建上面文件之前已经提交代码到版本库了,那么这个时候可以尝试以下方法将想要过滤的相关文件,那么只能关掉开发工具,然后删除相关想要被过滤的文件。然后

git add -A

git commit -m "fixed untracked files" git push origin master git pull 此时打开开发工具即可实现想要的过滤效果了。

6,然后基本上万事具备,在push之前需要先pull一下,不然你会被拒绝的,就是去下载一下那个Readme文件 !

android studio oscGit使用

android studio oscGit使用

转载于:https://my.oschina.net/u/556624/blog/478307

相关文章:

  • 2021-10-29
  • 2021-10-26
  • 2021-08-25
  • 2021-05-05
  • 2021-07-20
  • 2022-01-10
  • 2021-05-01
猜你喜欢
  • 2021-09-06
  • 2021-08-21
  • 2021-09-15
  • 2022-02-08
  • 2021-10-28
  • 2021-05-18
  • 2021-06-13
相关资源
相似解决方案