git 提交方法
Contents
1 配置 git客户端
git config –global user.name “You Name”
git config –global user.email yourmail@server.com
2 注册github密钥
ssh-keygen -C 'yourmail@server.com‘ -t rsa
3 github上验证
回到 GitHub 个人首页,点击 Account Settings -> SSH Public Keys -> Add another public key。title 可以随便取名字,Key 里面添加的内容为 id_rsa.pub 文件内所有的代码。然后点击 Apply 即可。
测试与 GitHub 是否连接成功:SSH -v git@github.com
4 github 中创建仓库
5 本地创建文件
6 初始化本地git 仓库
使用 git init 命令
7 提交到版本库
git add git commit -m ‘注释’
8 关联远程仓库
git remote add origin git@github.com:youusername/test.git
9 上传到github
git push -u origin master
question
error: failed to push some refs to 'git@github.com:brett427/java.git’
出现错误的主要原因是github中的README.md文件不在本地代码目录中
使用git pull – rebase origin master进行合并。