当前位置:   article > 正文

Git远程同步本地代码_git同步远程代码到本地

git同步远程代码到本地

初次使用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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

以下是代码更新后,使用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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/577342
推荐阅读
相关标签
  

闽ICP备14008679号