打造一款有趣的Android万能播放器之msysgit安装 github项目上传 修改 window中同步本地项目到github远程仓库

项目初衷

由于所在的公司比较注重项目安全性,所以在项目同步这块几乎没有涉足,乘工作之余敲一个简单的app,起名为EasyLive,目的于熟悉一些工作之外的有趣知识点和巩固自己的基础知识。

项目内容

以打造一款兼容性较为完整的android万能播放器为基础,后期再不断的添加一些生活中有趣的功能点,并不定期的将项目同步到github上,以供大家共同修改和指教。

目录

  • 集成准备------------------------------------------------------------------------------1
  • 前端UI设计---------------------------------------------------------------------------2
  • 播放器集成---------------------------------------------------------------------------3

集成准备

一、msysgit安装

1、下载git-for-windows

2、安装git-for-windows

(1)单击Next

          

     (2)选择安装目录

        

     (3)勾选创建桌面快捷方式、Git Bash、Git GUi、已经目录和后缀关联等,如图。

   

  (4)默认即可,单击Next

   

  (5)在“Adjusting your PATH environment”选项中,默认选项是“Use Git from the Windows Command Prompt”,这样在Windows的命令行cmd中也可以运行git命令了,点击“Next”。

   

  (6)配置行结束标记,保持默认“Checkout Windows-style, commit Unix-style line endings”.

   

  (7)在终端模拟器选择页面,默认即可,配置后Git Gash的终端比较易用。然后点击“Next”按钮

   

  (8)最后配置Git额外选择默认即可。

    

    

   (9)安装成功

   

   (10)安装Git完成之后,会在桌面创建Git Bash快捷方式,在任意目录下右击鼠标可以找打Git Bash Here的选项。

     

2、git配置

(1)   直接进入安装文件夹下打开git-bash.exe或右键桌面图标打开,本地创建SSH key     

ssh-keygen -t rsa -C "[email protected]"

  “”内是你自己的邮箱,一路回车,不需要输入。

  

(2) 成功的话会在~/下生成.ssh文件夹(C:\Users\Administrator\.ssh),进去,复制id_rsa.pub文件内容

(3)打开github网页,添加SSH   Key,名字随便起,Key是id_rsa.pub文件来的内容,点玩提交后会收到一条邮箱提示信息

(4)也可以在git bash下输入ssh -T [email protected]进行认证:

          

ssh -T [email protected]

    如果是第一次的会提示是否continue,输入yes就会看到:You've successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上github。

3、创建远程仓库和同步本地项目

(1)创建一个项目文件夹,习惯问题,直接进入你的项目文件夹下操作也是一样的

(2)点开Git安装文件夹下的git-bash.exe(如上图),进入项目文件夹,用git clone克隆远程仓库项目

cd workspace

通过密令git clone url克隆项目完后,直接对项目进行修改,然后再次提交即可同步到远程仓库上了。

git clone [email protected]:Life1412378121/EasyLive.git

(3)通过命令 git init 把这个目录变成git可以管理的仓库

git init

(4)把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件,可添加部分文件后面直接跟名字即可,可以通过git status来查看状态

git add .

(5)用命令 git commit -m告诉Git,把文件提交到仓库。“”引号内为提交说明也就是备注

git commit -m 'first commit'

(6)最后同步即可,第一次同步git push -u origin master,后面可以直接git push origin master

git push -u origin master

(7)到这里已经完成提交,这时候再回到网页上刷新一下,发现我们的项目已经同步过来了。

注:

1、如果你不是克隆项目下来修改再提交的话需要在第五步 (git commit -m)之后进行关联远程库

git remote add origin [email protected]:Life1412378121/EasyLive.git

2、获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败) 

git pull --rebase origin master

以下是我提交的错误和正确的实例

Administrator@PC-20180504BCPU MINGW64 / (master)
$ cd workspace/EasyLive/

Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git init
Reinitialized existing Git repository in D:/Git/workspace/EasyLive/.git/

Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git add .

Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   "Android\344\270\207\350\203\275\346\222\255\346\224\276\345\231\250\345\237\272\347\241\200demo.zip"
        deleted:    "Vitamio5.2.3\351\233\206\346\210\220demo"
        deleted:    test.txt


Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git commit -m "Vitamio 5.2.3基础demo"
[master 7711640] Vitamio 5.2.3基础demo
 3 files changed, 1 deletion(-)
 create mode 100644 "Android\344\270\207\350\203\275\346\222\255\346\224\276\345\231\250\345\237\272\347\241\200demo.zip"
 delete mode 100644 "Vitamio5.2.3\351\233\206\346\210\220demo"
 delete mode 100644 test.txt



//第一次提交没有关联时报的错
Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git push origin master
To https://github.com/Life1412378121/EasyLive.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Life1412378121/EasyLive.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.



//添加以下这两步,再提交即可
Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git remote add origin [email protected]:Life1412378121/EasyLive.git
fatal: remote origin already exists.

Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git pull --rebase origin master
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/Life1412378121/EasyLive
 * branch            master     -> FETCH_HEAD
   ccf50a4..55b1f9d  master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: Vitamio 5.2.3基础demo
Using index info to reconstruct a base tree...
A       "Vitamio5.2.3\351\233\206\346\210\220demo"
A       test.txt
Falling back to patching base and 3-way merge...

Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$ git push -u origin master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 24.97 MiB | 2.34 MiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/Life1412378121/EasyLive.git
   55b1f9d..8ae102e  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

Administrator@PC-20180504BCPU MINGW64 /workspace/EasyLive (master)
$

20181215第一版demo---Vitamio 5.2.3基础demo   官网

这里是项目更新demohttps://github.com/Life1412378121/EasyLive

THE END 感谢您的查看,如喜欢,欢迎您的star/fork ,小菜我叫吴明辉,期待与您一同打造一个无广告甚至免费的万能播放器。

猜你喜欢

转载自blog.csdn.net/qq_35350654/article/details/85014651