码迷,mamicode.com
首页 > 其他好文 > 详细

Github入坑总结一下

时间:2018-05-31 13:21:32      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:checkout   github   没有   绿色   ESS   icons   git push   icon   验证   

前言

最近在使用GitHub上遇到各种问题,找了各种方法进行解决,现今总结一下,以备后用。

具体问题

首先,上传分支的代码过程

git checkout branch(分支名)

切换到分支上,先将代码提交到本地仓库

git add .
git commit -m "add icons"

再将本地仓库同步到线上

git push --set-upstream origin branch(分支名)

此时,本地仓库上的分支内容即被传到线上的分支上

再切换到主分支上

git checkout master

master分支上放的是整个项目最新的代码,所以需要将分支上的代码与master分支进行merge

git merge origin/branch(分支名)
git push

其次,在传输到GitHub上之后,GitHub上的绿格子没有显示,可能是由于git上的邮箱与GitHub上设置的邮箱名不一样

git config user.email   //查询git的邮箱信息
git config --global user.name "github的用户名" //设置你的git邮箱信息,一定要和GitHub的用户名相同

除此之外,还要注意在GitHub上,进入settings --> Emails 中查看primary email address显示的内容,当显示的是设置的邮箱是作为账户验证的邮箱。

最后,在修改好邮箱的过程中,尝试了很多中方法,最后导致文件出现两个项目完全不同,重新提交一次的过程中出现了refusing to merge unrelated histories的错误,解决方法:

git pull --allow-unrelated-histories

重新merge上传之后,绿色格子也会出来。

Github入坑总结一下

标签:checkout   github   没有   绿色   ESS   icons   git push   icon   验证   

原文地址:https://www.cnblogs.com/alicsu/p/9116144.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!