
- Git - خانه
- Git - مفاهیم پایه
- Git - نصب و تنظیمات محیط
- Git - چرخه زندگی
- Git - درست عملیات
- Git - عملیات کلون
- Git - انجام تغییرات
- Git - نقد و بررسی تغییرات
- Git - Commit ایجاد تغییر در
- Git - Push عملیات
- Git - عملیات بهروزرسانیn
- Git - Stash عملیات
- Git - Move عملیات
- Git - عملیات تغییر نام دادن
- Git - Delete عملیات
- Git - رفع اشتباهات
- Git - Tag عملیات
- Git - Patch عملیات
- Git - مدیریت Branch ها
- Git - سیستم های انتقال مواد درگیری
- Git - های مختلف Platform
- Git - انبارهای برخط
Git -
Remote repository Git Server . Git Server
# add new group [root@CentOS ~]# groupadd dev # add new user [root@CentOS ~]# useradd -G devs -d /home/gituser -m -s /bin/bash gituser # change password [root@CentOS ~]# passwd gituser
:
Changing password for user gituser. New password: Retype new password: passwd: all authentication token updated successfully.
bare-- init . work directory . git. .
[gituser@CentOS ~]$ pwd /home/gituser [gituser@CentOS ~]$ mkdir project.git [gituser@CentOS ~]$ cd project.git/ [gituser@CentOS project.git]$ ls [gituser@CentOS project.git]$ git --bare init Initialized empty Git repository in /home/gituser-m/project.git/ [gituser@CentOS project.git]$ ls branches config description HEAD hooks info objects refs
Public/private RSA Key pair
Git Server Ssh keygen RSA .
Enter . .ssh directory Home Directory .
tom@CentOS ~]$ pwd /home/tom [tom@CentOS ~]$ ssh-keygen
:
Generating public/private rsa key pair. Enter file in which to save the key (/home/tom/.ssh/id_rsa): Press Enter Only Created directory '/home/tom/.ssh'. Enter passphrase (empty for no passphrase): ---------------> Press Enter Only Enter same passphrase again: ------------------------------> Press Enter Only Your identification has been saved in /home/tom/.ssh/id_rsa. Your public key has been saved in /home/tom/.ssh/id_rsa.pub. The key fingerprint is: df:93:8c:a1:b8:b7:67:69:3a:1f:65:e8:0e:e9:25:a1 tom@CentOS The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | . | | Soo | | o*B. | | E = *.= | | oo==. . | | ..+Oo | +-----------------+
ssh-keygen Private(i.e. id_rsa) Public(i.e. id_rsa.pub).
: private .
1 Tom, Jerry .
Tom ssh-copy-id Tom :
[tom@CentOS ~]$ pwd /home/tom [tom@CentOS ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub gituser@git.server.com
:
gituser@git.server.com's password: Now try logging into the machine, with "ssh 'gituser@git.server.com'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
Jerry :
[jerry@CentOS ~]$ pwd /home/jerry [jerry@CentOS ~]$ ssh-copy-id -i ~/.ssh/id_rsa gituser@git.server.com
:
gituser@git.server.com's password: Now try logging into the machine, with "ssh 'gituser@git.server.com'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
Push Git (Git server repository)
. Tom Jerry Push .
git init .git directory metadata . .git/config .
Tom directory README ) ( initial commit, commit . Commit git log
[tom@CentOS ~]$ pwd /home/tom [tom@CentOS ~]$ mkdir tom_repo [tom@CentOS ~]$ cd tom_repo/ [tom@CentOS tom_repo]$ git init Initialized empty Git repository in /home/tom/tom_repo/.git/ [tom@CentOS tom_repo]$ echo 'TODO: Add contents for README' > README [tom@CentOS tom_repo]$ git status -s ?? README [tom@CentOS tom_repo]$ git add . [tom@CentOS tom_repo]$ git status -s A README [tom@CentOS tom_repo]$ git commit -m 'Initial commit'
:
[master (root-commit) 19ae206] Initial commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 README
Tom log git log :
[tom@CentOS tom_repo]$ git log
:
commit 19ae20683fc460db7d127cf201a1429523b0e319 Author: Tom Cat <tom@tutorialspoint.com> Date: Wed Sep 11 07:32:56 2013 +0530 Initial commit
Tom . Push git server remote repository . remote )( . push
git branch push branch remote repository push branch . push origin master branch .
[tom@CentOS tom_repo]$ git remote add origin gituser@git.server.com:project.git [tom@CentOS tom_repo]$ git push origin master
:
Counting objects: 3, done. Writing objects: 100% (3/3), 242 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To gituser@git.server.com:project.git * [new branch] master −> master
remote repository git server .