github

注册地址:https://github.com/

创建一个repository name,输入框随便取一个名字(不要用中文!!!)

git是本地客户端管理代码的一个工具,下载地址:https://git-scm.com/download/win

安装完成后,本地随便建个文件夹,如github,在文件地址栏输入cmd

第一步:git init --建仓

第二步:git add  * --添加代码到本地仓库(*是代码添加全部更新的)

第三步:git commit -m "first commit"  --提交到本地缓存(“引号里面是说明提交了什么东西”)

如果看到上面的提示,就在cmd里面继续敲这两行:

>git config --global user.name "xxx@xxx.com(你的github邮箱)"   

>git config --global user.email "你的github用户名"(敲完之后,继续上面的commit这一步)

git remote add origin https://github.com/yoyoketang/yoyoketang.git  --提交到远程github上(后面的地址,就是之前配置的repository地址)

git push -u origin master  --push到master分支

遇到问题与解决方案注意:初次使用的话,在输入上面指令过程中会遇到以下几个问题:

1.要是cmd窗口看到提示以下这两个信息

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

解决办法:按上面的提升,cmd窗口接着输入

>git config --global user.name "这里是你的github用户名"   

>git config --global user.email xxx@xxx.com(你的邮箱)

2.提交到远程时候,提示:

fatal: remote origin already exists.

解决办法:删除远程git仓库

>git remote rm origin

3.首次操作过程中需要登录就按提示输入账号名和密码

=======================================================================

把大神的代码clone到本地,或者clone自己github上的代码,使用指令:

>git clone https://github.com/yoyoketang/yoyoketang.git

git status可以看到On branch master,这个说明已经在master分支上了

更新后使用git add * (*是更新全部)

>git add *

3.接着输入git commit -m "更新说明“,commit只是提交到缓存区域

如果是多人同时开发维护代码,得先git pull ,拉取当前分支最新代码

>git pull

5.最后git push origin master,最后一步才是push到远程的master分支上

posted @ 2019-09-26 17:05  千年妖狐  阅读(297)  评论(0编辑  收藏  举报