windows上传本地代码到github教程

参考文章:http://blog.csdn.net/lsyz0021/article/details/51292311

参考文章

1.注册github账户以及创建仓库

注册github账户我就不介绍了,so easy ,然后就是创建仓库----->Create a New Repository,图示如下:


windows上传本地代码到github教程_第1张图片

2.安装msysgit命令行工具和客户端TortoiseGit

msysgit命令行工具下载地址

客户端TortoiseGit下载地址


3.配置msysgit(这里也可以用TortoiseGit客户端去操作,不累述)

3.1.需要设置username和email,因为github每次commit都会记录他们

设置用户名 :git config --global user.name "you_user_name"
设置邮箱:git config --global user.email "you_email"


windows上传本地代码到github教程_第2张图片

查看用户名是否配置成功:git config user.name

查看邮箱是否配置成功: git config user.email


windows上传本地代码到github教程_第3张图片



4.建立git仓库

4.0   git切换目录常用命令:

切换到F盘:   cd  F:


切换到F盘 androidRel目录:cd androidRel


直接切换到F盘F:\AndroidRel\AndroidStudioSpace\CustomView :cd  F:/AndroidRel/AndroidStudioSpace/CustomView   【注:把 \ 换成 / 】


返回上一级目录  :cd  ..





4.1.cd到你的本地项目根目录下(D:\Git\RetrofitTest-master),初始化仓库 :  git    init


4.24.2将项目的所有文件添加到仓库中

git  add  .



4.3将add的文件commit到仓库

git commit -m "注释语句"


4.4.将本地的仓库关联到github上

git remote add origin   https://自己的仓库url地址

windows上传本地代码到github教程_第4张图片

4.5.上传github之前,要先pull一下,执行如下命令:

git pull origin master

输出如下:


4.6.上传代码到github远程仓库

git   push  -u   origin master

输出如下:


windows上传本地代码到github教程_第5张图片



4.7.查看你的远程代码地址(例如我自己的:https://github.com/Asmewill/testApp

代码上传成功,over,大功告成


windows上传本地代码到github教程_第6张图片

你可能感兴趣的:(windows上传本地代码到github教程)