gitlab 配置

1. 新建project


The repository for this project is emptyIf you already have files you can push them using command line instructions below.Otherwise you can start with adding a README, a LICENSE, or a .gitignore to this project.
Command line instructions
Git global setupgit config –global user.name “Administrator”
git config –global user.email “admin@example.com”Create a new repositorygit clone cd yaobin_test
touch README.md
git add README.md
git commit -m “add README”
git push -u origin masterExisting folder or Git repositorycd existing_folder
git init
git remote add origin git add .
git commitgit commit

git push -u origin master

2. 增加key

①增加172.18.7.79 机器的key

  1. [root@action_test ~/.ssh]# ssh-keygen -C "chenyaobin"
  2. Generating public/private rsa key pair.
  3. Enter file in which to save the key (/root/.ssh/id_rsa):
  4. Enter passphrase (empty for no passphrase):
  5. Enter same passphrase again:
  6. Your identification has been saved in /root/.ssh/id_rsa.
  7. Your public key has been saved in /root/.ssh/id_rsa.pub.
  8. The key fingerprint is:
  9. 4d:c7:63:aa:27:e9:5c:2c:3c:5d:b7:d0:6a:86:8c:15 chenyaobin
  10. The key's randomart image is:
  11. +--[ RSA 2048]----+
  12. | |
  13. | . |
  14. | E = |
  15. | o = o |
  16. | S + o o |
  17. | . O o + . |
  18. | O B + . |
  19. | o * o |
  20. | o |
  21. +-----------------+
  22. [root@action_test ~/.ssh]# cat id_rsa.pub
  23. ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA62MGMDF6w7PawPORPocJBqPy58rjtcvkyTVC9FoBetbU5VDpaEpKgnfl8TZOO7bUr4CVKuaGEQdS8Xo5kkomlfrxbyyUV0CCd/WtKROPOO8wyIBOY1HdvPeTa+N/pgcw9QnAZbMTIFCXlzPYIamtKQvWgwpVC/tJPalQL4RFJyKDEGf5fLdxAUz1nqmScqfuCsM/cJ8tiHja90sPhwyBGrDwt0znPtcU9Jz9symxemE+IEF3fdge5rP/TvzJdEQX8HZPT8Zf4cI29GnWtNB+OV6MM5FtJUjBtHSqvxcLnNxbatWrGDYXI1y35ST43FIKToR29XJGJW1fE3Pa2z2Pdw== chenyaobin
  • 在gitlab上增加key

  • 尝试clone:

[root@action_test /shell]# git clone git@slave2:root/yaobin_test.git
Initialized empty Git repository in /shell/yaobin_test/.git/
warning: You appear to have cloned an empty repository.

② 增加我自己pc机器的key

  • 首先查看自己pc机器的pub key

  • 在gitlab上增加自己机器的key

  • 自己写host slave2后,尝试clone

    • 成功!!

3. 初始化yaobin_test 项目

  1. [root@action_test /shell/yaobin_test]# ls
  2. README.md
  3. [root@action_test /shell/yaobin_test]# mkdir a b c
  4. [root@action_test /shell/yaobin_test]# ls
  5. a b c README.md
  6. [root@action_test /shell/yaobin_test]# touch ^C
  7. [root@action_test /shell/yaobin_test]# cd a
  8. [root@action_test /shell/yaobin_test/a]# ls
  9. [root@action_test /shell/yaobin_test/a]# echo aaaaaaaa> 1
  10. [root@action_test /shell/yaobin_test/a]# ls
  11. 1
  12. [root@action_test /shell/yaobin_test/a]# cd ../
  13. [root@action_test /shell/yaobin_test]# ls
  14. a b c README.md
  15. [root@action_test /shell/yaobin_test]# cd b/
  16. [root@action_test /shell/yaobin_test/b]# ls
  17. [root@action_test /shell/yaobin_test/b]# echo bbbbbbbbbbbb>2
  18. [root@action_test /shell/yaobin_test/b]# ls
  19. 2
  20. [root@action_test /shell/yaobin_test/b]# cd ../c
  21. [root@action_test /shell/yaobin_test/c]# ls
  22. [root@action_test /shell/yaobin_test/c]# echo ccccccccccccc>3
  23. [root@action_test /shell/yaobin_test/c]# ls
  24. 3
  25. [root@action_test /shell/yaobin_test/c]# cd ../
  26. [root@action_test /shell/yaobin_test]# ls
  27. a b c README.md
  28. [root@action_test /shell/yaobin_test]# git add ./
  29. [root@action_test /shell/yaobin_test]# ls
  30. a b c README.md
  31. [root@action_test /shell/yaobin_test]# git status
  32. # On branch master
  33. #
  34. # Initial commit
  35. #
  36. # Changes to be committed:
  37. # (use "git rm --cached <file>..." to unstage)
  38. #
  39. # new file: README.md
  40. # new file: a/1
  41. # new file: b/2
  42. # new file: c/3
  43. #
  44. [root@action_test /shell/yaobin_test]# git commit -m "first add file"
  45. [master (root-commit) 409f288] first add file
  46. Committer: root <root@action_test.(none)>
  47. Your name and email address were configured automatically based
  48. on your username and hostname. Please check that they are accurate.
  49. You can suppress this message by setting them explicitly:
  50. git config --global user.name "Your Name"
  51. git config --global user.email you@example.com
  52. If the identity used for this commit is wrong, you can fix it with:
  53. git commit --amend --author='Your Name <you@example.com>'
  54. 4 files changed, 9 insertions(+), 0 deletions(-)
  55. create mode 100644 README.md
  56. create mode 100644 a/1
  57. create mode 100644 b/2
  58. create mode 100644 c/3
  59. [root@action_test /shell/yaobin_test]# git config --global user.name "chenyaobin"
  60. [root@action_test /shell/yaobin_test]# git config --global user.email qwerty0113250159@126.com
  61. [root@action_test /shell/yaobin_test]# git status
  62. # On branch master
  63. nothing to commit (working directory clean)
  64. [root@action_test /shell/yaobin_test]# git push -u origin master
  65. Counting objects: 9, done.
  66. Delta compression using up to 8 threads.
  67. Compressing objects: 100% (3/3), done.
  68. Writing objects: 100% (9/9), 501 bytes, done.
  69. Total 9 (delta 0), reused 0 (delta 0)
  70. To git@slave2:root/yaobin_test.git
  71. * [new branch] master -> master
  72. Branch master set up to track remote branch master from origin.
  1. hello

最后总结:发现它的一些操作和github很像!!





posted on 2016-10-15 10:45  等待唐僧的日子  阅读(2429)  评论(0编辑  收藏  举报