a. 建立自己的github帐号
b.下载客户端,window系统的话,下载git for windows
c. 配置基础环境并上传代码到github上

下面是详细操作以及可能遇到的问题

配置user.name user.email

git config --global user.name "用户名"
git config --global user.eamil "574377670@qq.com"

创建SSH KEY

ssh-keygen -t rsa –C “youremail@example.com”

回车 回车

并将ssh key添加到github上

建立本地的仓库文件夹

mkdir test

cd test

git init -----初始化使文件夹变成git可以管理的仓库

git add a.text ------添加到暂存区

git commit -m "注释" -----提交

git remote add origin https://github.com/tugenhua0707/testgit.git ----本地仓库和远程仓库

连接

git 删除远程连接 git remote remove origin

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

git pull origin master 相当于git fetch 和 git merge

百度知道的解释 https://zhidao.baidu.com/question/200204875340723965.html

首先从远程的origin的master主分支下载最新的版本到origin/master分支上
然后比较本地的master分支和origin/master分支的差别
最后进行合并


http://blog.csdn.net/hanhailong726188/article/details/46738929 伯乐在线 git教材

http://blog.jobbole.com/78960/ CSDN教你上传本地代码到github

https://www.zhihu.com/question/20070065 知乎上的回答

当我在github上新建一个文件后直接push

$ git push origin master
Warning: Permanently added the RSA host key for IP address '192.30.255.113' to t he

list of known hosts.
To git@github.com:Eugene1024/Sstart.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:Eugene1024/Sstart.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.
QQ截图20170728223158.png