git+github使用
1.在github上新建一个Repository,基本信息完成后记下git@github.com:xxx/xxx.git.
2.本地配置
用户名和邮件配置默认会在 ~/.gitconfig
#git config --global user.name "username"
#git config --global user.email wanghuafire@gmail.com
生成key,默认会在/root/.ssh/id_rsa.pub,把里面的所有内容都copy到github的accounting下面的ssh keys里面
#ssh-keygen -C 'wanghuafire@gmail.com' -t rsa
最初的时候我一直都是需要用户名和密码认证,提交失败,返回403,然后是error,可以修改在你项目目录下./git/config
url = https://github.com/xxx/xxx.git
==>>修改
url = git@github.com:xxx/xxx.git
然后在你github上git地址采用ssh提交就行了。
更新本地代码之后
#git status ==>> 可以查看当前代码更新后状态,是否提交到仓库里了
#git add .
#git commit -m "test debug"
#git push user_name master
你就可以在github上面看得更改历史了