初次使用git上传代码:
cd ${你的工程代码目录}
git init
git add .
git commit -m 'add xxx'
git remote add origin https://github.com/lcm-linux/test.git #你的项目地址
git remote -v
git push -u origin master
以下是代码更新后,使用git提交的过程
[root@testserver-1 /data1/ansible]# git add -A
[root@testserver-1 /data1/ansible]# git commit -m 'update manual'
[master cb9c59a] update manual
5 files changed, 79 insertions(+), 2 deletions(-)
create mode 100644 manual/data_shell/pg_backup.sh
create mode 100644 manual/data_shell/pg_recover.sh
create mode 100644 "manual/read/apollo\347\216\257\345\242\203\350\277\201\347\247\273\346\223\215\344\275\234\346\211\213\345\206\214.docx"
delete mode 100644 "manual/word_clouds/\350\257\215\344\272\221\345\256\211\350\243\205\350\257\264\346\230\216.docx"
[root@testserver-1 /data1/ansible]# git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
# (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
[root@testserver-1 /data1/ansible]# git remote -v
origin git@git.xxx.com:DevOps_yw/K007-ansible.git (fetch)
origin git@git.xxx.com:DevOps_yw/K007-ansible.git (push)
[root@testserver-1 /data1/ansible]# git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Counting objects: 19, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (12/12), 364.01 KiB | 0 bytes/s, done.
Total 12 (delta 4), reused 0 (delta 0)
remote: branchName=master ....begin code check........
To git@git.xxx.com:DevOps_yw/K007-ansible.git
6b4933d..cb9c59a master -> master