Posted in Git, Service

Git | Merge Source With Diff And Patch Between Other Branches

Switch to [branch-A] to apply [branch-B]'s

$) git diff [branch-B] [path] > [patch_name]
$) patch -R -p1 < [patch_name]
Advertisements
Posted in Git, Server, Service

Git Management with gitolite.

The concept is to manage a git repository with an single gitolite user(account), not create users(accounts) for all git users.

$) sudo adduser gitolite

$) sudo adduser git

 

$) su – git

$) git clone git@https://github.com/sitaramc/gitolite.git

$) ./gitolite/install

 

$) su – gitolite

$) ssh-keygen

$) scp ~/.ssh/id_rsa.pub git@localhost:/home/git/.ssh/gitolite.pub

 

$) su – git

$) ./gitolite/src/gitolite setup -pk ~/.ssh/gitolite.pub

 

# Add Client User

$) su – gitolite

$) git clone git@localhost:gitolite-admin.git

$) cd gitolite-admin/keydir

$) scp [user_name]@localhost:/home/[user_name]/.ssh/id_rsa.pub . [user_name].pub

$) git add ./keydir/[user-name].pub

$) git commit -am “add user ‘[user_name]'”

$) git push

 

# Add A Repository

$) vi ./gitolite-admin/conf/gitolite.conf

repo gitolite-admin
    RW+     =   gitolite

repo testing
    RW+     =   @all

repo test
    RW+     =   [user_name]

$) git commit -am “add a [repo_name] repository.”

$) git push

 

# Retrieve A Git Repository At A Client

$) su – [user_name]

$) git clone git@localhost:test.git

 

# Git Remote Reference and Branch
$) git ls-remote

$) git remote show

 

 

Reference Source
: http://www.whatwant.com/331
: https://git-scm.com/book/ko/v2/Git-%EB%B8%8C%EB%9E%9C%EC%B9%98-%EB%A6%AC%EB%AA%A8%ED%8A%B8-%EB%B8%8C%EB%9E%9C%EC%B9%98

 

Posted in Git, Service, Uncategorized

Git Server Setting on Ubuntu

# Install GIT

$) sudo add-apt-repository ppa:git-core/ppa

$) sudo apt-get update

$) sudo apt-get install git-core

$) git version

 

# Create an admin account

$) sudo adduser git

$) su – git

$) cd ~

$) mkdir .ssh

$) sudo chmod 700 .ssh

$) cat id_rsa.pub >> ~/.ssh/authorized_keys

$) chmod 600 ~/.ssh/authorized_keys

$) rm -rf id_rsa.pub

# Security Settings

$) sudo vi /etc/passwd
(If the message “user id(account) is not in the sudoers file.” shows, see here.)

from

git:x:1001:1001:,,,:/home/git:/bin/bash

to

git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell

Now the access is denied.

 

# Create repository

Login or connect git account to local or remote machine.

$) cd ~

$) mkdir [repo-name].git

$) cd [repo-name].git

If it is a first try,

$) git init –bare –shared

Or there is a being used repository

$) git clone –bare –shared [repo-url]

 

# Retrieve by client

$) git clone git@[git-repo-url]:test.git

 

Reference Source : http://webdir.tistory.com/220