文章目录
前置条件
github上面已有库项目Repository (MyFirstGitProject)
第一种情况:你的项目还没跟github目标库MyFirstGitProject建立连接:
1.cd C:\Users\Administrator\Desktop\MyProject
//进入到你要提交的项目文件夹
2. git init
//这是初始化在这个文件夹中建立一个空库
3.git add .
//这个命令 你可以直接 git add . 这是把当前文件夹中的所有文件都加入到上传的列表中(注意要有空格),你还可以添加具体的文件 git add 你要添加的文件 (输入ls命令回车,你可以查看C:\Users\Administrator\Desktop\MyProject下面的文件)
(注意: 此处可能会报错)
<1>错误如下
warning: LF will be replaced by CRLF in gradlew.
The file will have its original line endings in your working directory
<2>解决方法
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git config --global core.autocrlf true
4.git commit -m “更新内容说明”"
5.git remote add origin https://github.com/waitForWind/MyFirstGitProject.git
//这里说两处地方 origin 这个相当于是个别名 你可以自己随便写也可以写成当前文件夹的名 , 后面的地址是你在GITHUB 刚刚新建的 库 地址, 你建了哪几个库,你到GITHUB找到 你 建的库点进去 就能看到相应的地址.
6.git push -u origin master
//开始上传了 ,然后 会提示你 输入 你在 GITHUB上注册的用户名跟密码 输入正确后就等着上传吧
jack@DESKTOP-DVU0UQ9 MINGW64 ~/Desktop
$ git config --global user.name
15170616674
jack@DESKTOP-DVU0UQ9 MINGW64 ~/Desktop
$ git config --global user.email
2780048423@qq.com
jack@DESKTOP-DVU0UQ9 MINGW64 ~/Desktop
$ cd f:
jack@DESKTOP-DVU0UQ9 MINGW64 /f
$ cd androidfirstcode/adapter5
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5
$ git init
Initialized empty Git repository in F:/androidfirstcode/adapter5/.git/
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ ls -al
total 55
drwxr-xr-x 1 jack 197121 0 Dec 15 00:43 ./
drwxr-xr-x 1 jack 197121 0 Dec 14 20:48 ../
drwxr-xr-x 1 jack 197121 0 Dec 15 00:43 .git/
-rw-r--r-- 1 jack 197121 240 Dec 14 20:52 .gitignore
drwxr-xr-x 1 jack 197121 0 Dec 14 20:52 .gradle/
drwxr-xr-x 1 jack 197121 0 Dec 15 00:36 .idea/
drwxr-xr-x 1 jack 197121 0 Dec 15 00:30 ActivityCollector/
drwxr-xr-x 1 jack 197121 0 Dec 14 22:46 BroadcastTest2/
drwxr-xr-x 1 jack 197121 0 Dec 14 23:01 app/
-rw-r--r-- 1 jack 197121 563 Dec 14 21:49 build.gradle
drwxr-xr-x 1 jack 197121 0 Dec 14 20:52 gradle/
-rw-r--r-- 1 jack 197121 1111 Dec 14 20:52 gradle.properties
-rwxr-xr-x 1 jack 197121 5296 Dec 14 20:52 gradlew*
-rw-r--r-- 1 jack 197121 2260 Dec 14 20:52 gradlew.bat
-rw-r--r-- 1 jack 197121 458 Dec 14 20:52 local.properties
-rw-r--r-- 1 jack 197121 142 Dec 14 23:30 settings.gradle
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git add .
warning: LF will be replaced by CRLF in gradlew.
The file will have its original line endings in your working directory
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git config --global core.autocrlf true
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git add .
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git commit -m "First commit"
[master (root-commit) 6964cee] First commit
100 files changed, 1957 insertions(+)
create mode 100644 .gitignore
create mode 100644 .idea/.gitignore
create mode 100644 .idea/.name
create mode 100644 .idea/compiler.xml
create mode 100644 .idea/gradle.xml
create mode 100644 .idea/jarRepositories.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/vcs.xml
create mode 100644 ActivityCollector/.gitignore
create mode 100644 ActivityCollector/build.gradle
create mode 100644 ActivityCollector/proguard-rules.pro
create mode 100644 ActivityCollector/src/androidTest/java/com/example/activitycollector/ExampleInstrumentedTest.java
create mode 100644 ActivityCollector/src/main/AndroidManifest.xml
create mode 100644 ActivityCollector/src/main/java/com/example/activitycollector/ActivityCollector.java
create mode 100644 ActivityCollector/src/main/java/com/example/activitycollector/BaseActivity.java
create mode 100644 ActivityCollector/src/main/java/com/example/activitycollector/LoginActivity.java
create mode 100644 ActivityCollector/src/main/java/com/example/activitycollector/MainActivity.java
create mode 100644 ActivityCollector/src/main/res/drawable-v24/ic_launcher_foreground.xml
create mode 100644 ActivityCollector/src/main/res/drawable/ic_launcher_background.xml
create mode 100644 ActivityCollector/src/main/res/layout/activity_login.xml
create mode 100644 ActivityCollector/src/main/res/layout/activity_main.xml
create mode 100644 ActivityCollector/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
create mode 100644 ActivityCollector/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
create mode 100644 ActivityCollector/src/main/res/mipmap-hdpi/ic_launcher.png
create mode 100644 ActivityCollector/src/main/res/mipmap-hdpi/ic_launcher_round.png
create mode 100644 ActivityCollector/src/main/res/mipmap-mdpi/ic_launcher.png
create mode 100644 ActivityCollector/src/main/res/mipmap-mdpi/ic_launcher_round.png
create mode 100644 ActivityCollector/src/main/res/mipmap-xhdpi/ic_launcher.png
create mode 100644 ActivityCollector/src/main/res/mipmap-xhdpi/ic_launcher_round.png
create mode 100644 ActivityCollector/src/main/res/mipmap-xxhdpi/ic_launcher.png
create mode 100644 ActivityCollector/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
create mode 100644 ActivityCollector/src/main/res/mipmap-xxxhdpi/ic_launcher.png
create mode 100644 ActivityCollector/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
create mode 100644 ActivityCollector/src/main/res/values-night/themes.xml
create mode 100644 ActivityCollector/src/main/res/values/colors.xml
create mode 100644 ActivityCollector/src/main/res/values/strings.xml
create mode 100644 ActivityCollector/src/main/res/values/themes.xml
create mode 100644 ActivityCollector/src/test/java/com/example/activitycollector/ExampleUnitTest.java
create mode 100644 BroadcastTest2/.gitignore
create mode 100644 BroadcastTest2/build.gradle
create mode 100644 BroadcastTest2/proguard-rules.pro
create mode 100644 BroadcastTest2/src/androidTest/java/com/example/broadcasttest2/ExampleInstrumentedTest.java
create mode 100644 BroadcastTest2/src/main/AndroidManifest.xml
create mode 100644 BroadcastTest2/src/main/java/com/example/broadcasttest2/AnotherBroadcastReceiver.java
create mode 100644 BroadcastTest2/src/main/java/com/example/broadcasttest2/MainActivity.java
create mode 100644 BroadcastTest2/src/main/res/drawable-v24/ic_launcher_foreground.xml
create mode 100644 BroadcastTest2/src/main/res/drawable/ic_launcher_background.xml
create mode 100644 BroadcastTest2/src/main/res/layout/activity_main.xml
create mode 100644 BroadcastTest2/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
create mode 100644 BroadcastTest2/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
create mode 100644 BroadcastTest2/src/main/res/mipmap-hdpi/ic_launcher.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-hdpi/ic_launcher_round.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-mdpi/ic_launcher.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-mdpi/ic_launcher_round.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-xhdpi/ic_launcher.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-xhdpi/ic_launcher_round.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-xxhdpi/ic_launcher.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-xxxhdpi/ic_launcher.png
create mode 100644 BroadcastTest2/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
create mode 100644 BroadcastTest2/src/main/res/values-night/themes.xml
create mode 100644 BroadcastTest2/src/main/res/values/colors.xml
create mode 100644 BroadcastTest2/src/main/res/values/strings.xml
create mode 100644 BroadcastTest2/src/main/res/values/themes.xml
create mode 100644 BroadcastTest2/src/test/java/com/example/broadcasttest2/ExampleUnitTest.java
create mode 100644 app/.gitignore
create mode 100644 app/build.gradle
create mode 100644 app/proguard-rules.pro
create mode 100644 app/src/androidTest/java/com/example/broadcasttest/ExampleInstrumentedTest.java
create mode 100644 app/src/main/AndroidManifest.xml
create mode 100644 app/src/main/java/com/example/broadcasttest/BootCompleteReceiver.java
create mode 100644 app/src/main/java/com/example/broadcasttest/MainActivity.java
create mode 100644 app/src/main/java/com/example/broadcasttest/MyBroadcastReceiver.java
create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml
create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml
create mode 100644 app/src/main/res/layout/activity_main.xml
create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png
create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png
create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png
create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png
create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png
create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png
create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
create mode 100644 app/src/main/res/values-night/themes.xml
create mode 100644 app/src/main/res/values/colors.xml
create mode 100644 app/src/main/res/values/strings.xml
create mode 100644 app/src/main/res/values/themes.xml
create mode 100644 app/src/test/java/com/example/broadcasttest/ExampleUnitTest.java
create mode 100644 build.gradle
create mode 100644 gradle.properties
create mode 100644 gradle/wrapper/gradle-wrapper.jar
create mode 100644 gradle/wrapper/gradle-wrapper.properties
create mode 100644 gradlew
create mode 100644 gradlew.bat
create mode 100644 settings.gradle
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git remote add adapter5 https://github.com/151706166744/adapter5
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git push -u adapter5 master
Enumerating objects: 135, done.
Counting objects: 100% (135/135), done.
Delta compression using up to 4 threads
Compressing objects: 100% (92/92), done.
Writing objects: 100% (135/135), 139.17 KiB | 5.35 MiB/s, done.
Total 135 (delta 16), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (16/16), done.
To https://github.com/151706166744/adapter5
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'adapter5'.
第二种情况:更新代码的操作(不是第一次提交)
1.cd C:\Users\Administrator\Desktop\MyProject
//进入到你要提交的项目文件夹
2.git add .
//或者添加具体的文件 git add 你要添加的文件
3.git commit -m “说明”
4.git push -u origin master
真正开始上传代码到github //还记的这个别名吗 origin 这个别名就是你用第一种方法首次 向 GITHUB提交代码 你用的 别名
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ cd f:
jack@DESKTOP-DVU0UQ9 MINGW64 /f
$ cd androidfirstcode/adapter5
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git add .
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git commit -m "seconnd commit"
[master 7d5949f] seconnd commit
2 files changed, 10 insertions(+), 1 deletion(-)
jack@DESKTOP-DVU0UQ9 MINGW64 /f/androidfirstcode/adapter5 (master)
$ git push -u adapter5 master
Enumerating objects: 21, done.
Counting objects: 100% (21/21), done.
Delta compression using up to 4 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 944 bytes | 472.00 KiB/s, done.
Total 11 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To https://github.com/151706166744/adapter5
6964cee..7d5949f master -> master
Branch 'master' set up to track remote branch 'master' from 'adapter5'.
版权声明:本文为weixin_45997308原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。