Git托管代码到GitHub:
1.登录Github账号(没有的话先注册),创建一个版本库:
这里创建的版本库名为coolweather,选择Android类型的.gitignore文件,使用Apache v2 License作为项目开源协议。
点击Create repository按钮,coolweather这个版本库就创建完成了。版本库地址:https://github.com/tony-green/coolweather。
GitHub已经自动帮我们创建了.gitignore、LICENSE和README.md这三个文件,其中编辑README.md文件中的内容可以修改酷欧天气版本库主页的描述。
2.将github的远程版本库克隆到本地:
(1)复制地址:
点击
得到版本库地址:https://github.com/tony-green/coolweather.git。
(2)克隆本地:
git clone https://github.com/tony-green/coolweather.git
3.新建本地Android项目,并将上面的版本文件拷至项目下:使用ls –al查看下载结果:
(1)新建本地项目
(2)将2中从github克隆下的版本文件,拷贝到本地工程CoolWeather下,最终目录结构:
4.上传本地工程到github:
git add .
git commit -m "First commit."
git push origin master
注意:最后一步的时候可能需要账号密码,这里输入github的账号即可。
所有同步完成,刷新查看github网页: