git+github使用
git+github使用
git+github使用
1.在github上新建一个Repository,基本信息完成后记下git@github.com:xxx/xxx.git.
2.本地配置
用户名和邮件配置默认会在 ~/.gitconfig
www.2cto.com
#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
3.提交项目 www.2cto.com
#cd project_name
#git init
#git commit -m "test"
#git add .
#git remote add user_name git@github.com:xxx/xxx.git
#git push user_name master
user_name可以你自己指定
最初的时候我一直都是需要用户名和密码认证,提交失败,返回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上面看得更改历史了
评论暂时关闭