当前位置:   article > 正文

在windows克隆GitHub/GitLab远程项目,将本地代码推送到GitHub/GitLab远程仓库_windows怎么克隆gitlab私有项目

windows怎么克隆gitlab私有项目

目录

1、右击 Git Bash Here,进入windows的git操作页面

2、克隆GitLab远程项目到本地

3、切换路径到克隆的项目下

4、查看当前所有远程地址分支,默认在master分支下

5、切换到dev_Br20220610分支下

6、将代码打包到windows当前路线下

7、在windows上提交代码,添加到暂存区

8、添加日志信息,将代码提交到本地仓库

9、推送本地分支上的内容到远程仓库

10、如何将dev_Br20220610分支代码合并到master

11、从dev_Br20220610分支复制代码到新分支Odyssey-1.1.0


1、右击 Git Bash Here,进入windows的git操作页面

  1. windows进入到D:\Git-Space\git-Odyssey目录下
  2. 右击 Git Bash Here,进入git操作页面。

2、克隆GitLab远程项目到本地

克隆前不用初始化,因为克隆会自动做初始化。第一次可能会提示绑定账号和密码,绑定对应的gitlab账号密码即可,如截图所示。

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey
  2. $ git clone http://gitlab.com/bdop/bdopAutomatic.git
  3. Cloning into 'bdopAutomatic'...
  4. remote: Enumerating objects: 9, done.
  5. remote: Counting objects: 100% (9/9), done.
  6. remote: Compressing objects: 100% (6/6), done.
  7. remote: Total 9 (delta 1), reused 0 (delta 0), pack-reused 0
  8. Receiving objects: 100% (9/9), done.
  9. Resolving deltas: 100% (1/1), done.
第一次初始化提示绑定github账号密码

3、切换路径到克隆的项目下

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey
  2. $ ll
  3. total 4
  4. drwxr-xr-x 1 kele1210 1049089 0 6月 13 10:48 bdopAutomatic/
  5. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey
  6. $ cd bdopAutomatic/
  7. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (master)
  8. $ ll
  9. total 2
  10. -rw-r--r-- 1 kele1210 1049089 14 6月 13 10:48 README.md
  11. -rw-r--r-- 1 kele1210 1049089 11 6月 13 10:48 ReleaseNote.txt

4、查看当前所有远程地址分支,默认在master分支下

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (master)
  2. $ git branch -a
  3. dev_Br20220610
  4. * master
  5. remotes/origin/HEAD -> origin/master
  6. remotes/origin/dev_Br20220610
  7. remotes/origin/master

5、切换到dev_Br20220610分支下

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (master)
  2. $ git checkout dev_Br20220610
  3. Switched to branch 'dev_Br20220610'
  4. Your branch is up to date with 'origin/dev_Br20220610'.
  5. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (dev_Br20220610)
  6. $

6、将代码打包到windows当前路线下

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (dev_Br20220610)
  2. $ ll
  3. total 2
  4. drwxr-xr-x 1 kele1210 1049089 0 6月 13 11:36 Odyssey-1.0.0/
  5. -rw-r--r-- 1 kele1210 1049089 14 6月 13 10:48 README.md
  6. -rw-r--r-- 1 kele1210 1049089 11 6月 13 10:48 ReleaseNote.txt

7、在windows上提交代码,添加到暂存区

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (dev_Br20220610)
  2. $ git add Odyssey-1.0.0
  3. warning: LF will be replaced by CRLF in Odyssey-1.0.0/alarm/re_alarm.py.
  4. The file will have its original line endings in your working directory
  5. warning: LF will be replaced by CRLF in Odyssey-1.0.0/alarm/send_alarm.py.
  6. The file will have its original line endings in your working directory
  7. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Elasticsearch/config/sample.
  8. The file will have its original line endings in your working directory
  9. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Elasticsearch/script/es_alive.sh.
  10. The file will have its original line endings in your working directory
  11. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Elasticsearch/script/es_auto_start.sh.
  12. The file will have its original line endings in your working directory
  13. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Kafka/config/conf.
  14. The file will have its original line endings in your working directory
  15. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Kafka/config/sample.
  16. The file will have its original line endings in your working directory
  17. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Kafka/logs/kafka_auto_start.bak.
  18. The file will have its original line endings in your working directory
  19. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Kafka/script/kafka_auto_start.sh.
  20. The file will have its original line endings in your working directory
  21. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Zookeeper/config/conf.
  22. The file will have its original line endings in your working directory
  23. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Zookeeper/config/sample.
  24. The file will have its original line endings in your working directory
  25. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Zookeeper/logs/zk_auto_start.bak.
  26. The file will have its original line endings in your working directory
  27. warning: LF will be replaced by CRLF in Odyssey-1.0.0/component/Zookeeper/script/zk_auto_start.sh.
  28. The file will have its original line endings in your working directory
  29. warning: LF will be replaced by CRLF in Odyssey-1.0.0/dispatch/comp_conf.
  30. The file will have its original line endings in your working directory
  31. warning: LF will be replaced by CRLF in Odyssey-1.0.0/dispatch/dispatch.py.
  32. The file will have its original line endings in your working directory
  33. warning: LF will be replaced by CRLF in Odyssey-1.0.0/omanage/disp_conf.py.
  34. The file will have its original line endings in your working directory
  35. warning: LF will be replaced by CRLF in Odyssey-1.0.0/omanage/moni_log_del.sh.
  36. The file will have its original line endings in your working directory

8、添加日志信息,将代码提交到本地仓库

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (dev_Br20220610)
  2. $ git commit -m "第一次初始化Odyssey-1.0.0"
  3. [dev_Br20220610 76b6e4f] 第一次初始化Odyssey-1.0.0
  4. 21 files changed, 924 insertions(+)
  5. create mode 100644 Odyssey-1.0.0/alarm/re_alarm.py
  6. create mode 100644 Odyssey-1.0.0/alarm/re_alarm.pyc
  7. create mode 100644 Odyssey-1.0.0/alarm/send_alarm.py
  8. create mode 100644 Odyssey-1.0.0/alarm/send_alarm.pyc
  9. create mode 100644 Odyssey-1.0.0/component/Elasticsearch/config/conf
  10. create mode 100644 Odyssey-1.0.0/component/Elasticsearch/config/sample
  11. create mode 100644 Odyssey-1.0.0/component/Elasticsearch/script/es_alive.sh
  12. create mode 100644 Odyssey-1.0.0/component/Elasticsearch/script/es_auto_start.sh
  13. create mode 100644 Odyssey-1.0.0/component/Kafka/config/conf
  14. create mode 100644 Odyssey-1.0.0/component/Kafka/config/sample
  15. create mode 100644 Odyssey-1.0.0/component/Kafka/logs/kafka_auto_start.bak
  16. create mode 100644 Odyssey-1.0.0/component/Kafka/script/kafka_auto_start.sh
  17. create mode 100644 Odyssey-1.0.0/component/Zookeeper/config/conf
  18. create mode 100644 Odyssey-1.0.0/component/Zookeeper/config/sample
  19. create mode 100644 Odyssey-1.0.0/component/Zookeeper/logs/zk_auto_start.bak
  20. create mode 100644 Odyssey-1.0.0/component/Zookeeper/script/zk_auto_start.sh
  21. create mode 100644 Odyssey-1.0.0/dispatch/comp_conf
  22. create mode 100644 Odyssey-1.0.0/dispatch/dispatch.py
  23. create mode 100644 Odyssey-1.0.0/dispatch/last.time.dat
  24. create mode 100644 Odyssey-1.0.0/omanage/disp_conf.py
  25. create mode 100644 Odyssey-1.0.0/omanage/moni_log_del.sh

9、推送本地分支上的内容到远程仓库

  1. kele1210@CNHQ-kele1210N MINGW64 /d/Git-Space/git-Odyssey/bdopAutomatic (dev_Br20220610)
  2. $ git push
  3. Enumerating objects: 40, done.
  4. Counting objects: 100% (40/40), done.
  5. Delta compression using up to 4 threads
  6. Compressing objects: 100% (30/30), done.
  7. Writing objects: 100% (39/39), 13.47 KiB | 599.00 KiB/s, done.
  8. Total 39 (delta 2), reused 0 (delta 0), pack-reused 0
  9. remote: reposName:bdopAutomatic groupName:bdop branchname:dev_Br20220610
  10. remote: % Total % Received % Xferd Average Speed Time Time Time Current
  11. remote: Dload Upload Total Spent Left Speed
  12. remote: 100 1 100 1 0 0 90 0 --:--:-- --:--:-- --:--:-- 90
  13. remote: Mon Jun 13 10:53:13 CST 2022 send suc
  14. remote:
  15. remote: To create a merge request for dev_Br20220610, visit:
  16. remote: http://gitlab.com/bdop/bdopAutomatic/-/merge_requests/new?merge_request%5Bsource_branch%5D=dev_Br20220610
  17. remote:
  18. To http://gitlab.com/bdop/bdopAutomatic.git
  19. f1e9cdc..76b6e4f dev_Br20220610 -> dev_Br20220610

因为换电脑了,所以下面的操作截图有些地方不一样。不妨碍git命令执行

10、如何将dev_Br20220610分支代码合并到master

a.首先切换到master分支上

  1. kele1210@CNHQ-kele1210N MINGW64 /f/代码空间/gitsapce/bdalarm/Odyssey-1.0.0 (dev_Br20220610)
  2. $ git checkout master

b.将本地master代码,push到远程master上

  1. kele1210@CNHQ-kele1210N MINGW64 /f/代码空间/gitsapce/bdalarm/Odyssey-1.0.0/dispatch (master)
  2. $ git push origin master
  3. Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
  4. remote: reposName:bdopAutomatic groupName:bdop branchname:master
  5. remote: % Total % Received % Xferd Average Speed Time Time Time Current
  6. remote: Dload Upload Total Spent Left Speed
  7. remote: 100 1 100 1 0 0 111 0 --:--:-- --:--:-- --:--:-- 111
  8. remote: Mon Aug 29 10:05:32 CST 2022 send suc
  9. To http://gitlab.com/bdop/bdopAutomatic.git
  10. f1e9cdc..533c25a master -> master

11、从dev_Br20220610分支复制代码到新分支Odyssey-1.1.0

a、切换分支到dev_Br20220610分支上,并pull拉取最新代码

  1. kele1210@CNHQ-kele1210N MINGW64 /f/代码空间/gitsapce/bdalarm (master)
  2. $ git checkout dev_Br20220610
  3. Switched to branch 'dev_Br20220610'

b、新建Odyssey-1.1.0分支

  1. kele1210@CNHQ-kele1210N MINGW64 /f/代码空间/gitsapce/bdalarm/Odyssey-1.0.0/dispatch (master)
  2. $ git checkout -b Odyssey-1.1.0
  3. Switched to a new branch 'Odyssey-1.1.0'

c、将Odyssey-1.1.0分支的代码推送到远程服务器

  1. kele1210@CNHQ-kele1210N MINGW64 /f/代码空间/gitsapce/bdalarm (Odyssey-1.1.0)
  2. $ git push origin Odyssey-1.1.0
  3. Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
  4. remote: bdop : bdopAutomatic : Odyssey-1.1.0
  5. remote: % Total % Received % Xferd Average Speed Time Time Time Current
  6. remote: Dload Upload Total Spent Left Speed
  7. remote: 100 63 0 63 0 0 7875 0 --:--:-- --:--:-- --:--:-- 7875
  8. remote: {"resultCode":"0","message":"Executed successful!","data":null}
  9. remote: Mon Aug 29 11:45:47 CST 2022 {"resultCode":"0","message":"Executed successful!","data":null}
  10. remote:
  11. remote: To create a merge request for Odyssey-1.1.0, visit:
  12. remote: http://gitlab.com/bdop/bdopAutomatic/-/merge_requests/new?merge_request%5Bsource_branch%5D=Odyssey-1.1.0
  13. remote:
  14. To http://ggitlab.com/bdop/bdopAutomatic.git
  15. * [new branch] Odyssey-1.1.0 -> Odyssey-1.1.0

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/571824
推荐阅读
相关标签
  

闽ICP备14008679号