Git(非github客户端)的下载 :https://git-scm.com/downloads
安装:http://baijiahao.baidu.com/s?id=1601036689157983619&wfr=spider&for=pc
方法一(无法实时更新):
要勾选Initialize this repository with a README
方法二(可更新):
1.注册github账户,新建repository(仓库)
2.在要上传的文件夹界面鼠标右键点击Git Bash Here,复制这个仓库的地址并执行下列代码
3.在本地设置Git信息,设置用户名和邮箱。
git config --global user.name " " //你的名字或昵称
git config --global user.email " " //你的邮箱
git init //把这个目录变成Git可以管理的仓库
git add .
git commit -m "first commit"
git remote add origin https://github.com/weicms.git
//https://换成repository的地址
git push -u origin master //这一句执行后,登陆你的git账号和密码
01.修改工程名(慎改)
02.修改工程介绍
配置ssh (ssh不仅可用于远程主机登录,还可以直接在远程主机上执行操作):
1、在桌面新建任意文件,右键点击git bash here,输入
$ ssh-****** -t rsa -C "你的邮箱"
输入并回车,
open ~/.ssh
,如下图
打开id_rsa.pub,复制里面的key,回到github网站,进入Account Settings,选择SSH Keys,粘贴到key框内,title任意填写。2、在git bash下输入
$ ssh -T [email protected]
看到You’ve successfully authenticated就表示已成功连上github。
更新本地代码到gihub
git status //查看当前的git仓库状态
git add * //更新全部
git commit -m "更新说明" //接着输入git commit -m "更新说明"
git pull //先git pull,拉取当前分支最新代码
git push origin master //push到远程master分支上
出现new branch表示更新成功。