1.终端进入代码文件夹.
2.运行命令:git add --all.
3.运行命令:git commit -m "关于这次代码更新的评论"
回车之后可能会出现以下内容
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'chen@chen.(none)')
4.如果出现上述内容:运行命令:
git config --global user.email "you@example.com"
git config --global user.name “Your Name”
邮箱根据自己注册时的邮箱填写, Your Name 就是自己登录的用户名
5.再次运行 步骤3的命令
如果没有问题, 会有以下提示:
[develop 27e1b15] update cmakelists.txt
1 file changed, 1 insertion(+), 1 deletion(-)
6. 运行命令:git push
如果首次使用可能有如下提示信息:
warning: push.default 尚未设置,它的默认值在 Git 2.0 已从 'matching'
变更为 'simple'。若要不再显示本信息并保持传统习惯,进行如下设置:
git config --global push.default matching
若要不再显示本信息并从现在开始采用新的使用习惯,设置:
git config --global push.default simple
当 push.default 设置为 'matching' 后,git 将推送和远程同名的所有
本地分支。
从 Git 2.0 开始,Git 默认采用更为保守的 'simple' 模式,只推送当前
分支到远程关联的同名分支,即 'git push' 推送当前分支。
参见 'git help config' 并查找 'push.default' 以获取更多信息。
('simple' 模式由 Git 1.7.11 版本引入。如果您有时要使用老版本的 Git,
为保持兼容,请用 'current' 代替 'simple')
对象计数中: 3, 完成.
Delta compression using up to 8 threads.
压缩对象中: 100% (3/3), 完成.
写入对象中: 100% (3/3), 314 bytes | 0 bytes/s, 完成.
Total 3 (delta 2), reused 0 (delta 0)
To ssh://git@关于自己的代码信息.git
6669bfc..27e1b15 develop -> develop
7. 运行命令: git config --global push.default simple
至此, 上传代码完成, 可以登录网页查看是否上传成功.