git을 윈도우 로컬에서만 사용하려는데요

송지석의 이미지

예전에 올린 글에서 리눅스를 쓸 수 없었기에 MasterQ님이 가르쳐주신 대로 cygwin + puttycyg를 써서 터미널환경을 쓸 수 있게 됐습니다. (정보 주신 MasterQ님 감사) 그런데 회사의 버전 관리 툴이 좀 불편하고 그래서(소스코드도 각자 맡은 파일만 건드려야 돼고 자주 커밋을 못해서 말이죠.. 큰 조직이라 그런지..) 로컬에 버전 관리 프로그램을 써서 제 개인 저장소로 써볼까 하고 있습니다. 회사의 커밋 주기에 따라 커밋은 하되 그 중간중간은 제 컴퓨터에서 로그 남기고 버전관리하고 싶어서 말이죠

cvs, svn은 써봤는데 git이 요새 대세라니까 한번 써보려는데
이게 제가 모르는 부분이 있습니다.
뭐나면 svn은 file: 프로토콜이 있어서 로컬 저장소를 접근할 수 있는데요
git에서는 로컬에서 저장소 만들면 브랜치라던가 sync같은 게 안되는 걸까요?
서버 없이 로컬에서는 대표 저장소를 두고 브랜치나 태그 붙이고, 대표저장소에 커밋하고 안되나요?

TortoiseGit와 msysgit, cygwin git으로 클론 -> push로 해보려고 했는데 뭔가 에러메시지가 잔뜩 나면서 안되는군요..

서버 없이 작업할 수 있는 방법이 있는지 궁금증을 좀 풀어주시면 감사하겠습니다. :-)

lacovnk의 이미지

말씀하신대로 서버 없이 사용하기 위한 분산버전관리시스템이죠~

git 작업소는 그 자체가 저장소입니다.

그리고 저장소 끼리 push/pull 합니다 :) 딱히 중앙/대표 저장소가 있는 것이 아니라, 편의상 그렇게 이용하는 것이지요.

송지석의 이미지

회사 인터넷이 막혀있어서 글이 안올라가서 이제야 글 수정하네요
원래 lacovnk님께서 말씀하신 대로 대로 push/pull 로 쓰려고 했는데요
카피본(clone으로 복사해온)에서 원본으로 push하려고 하면 이렇게 에러가 납니다..

git.exe push    "origin" master:master
 
remote: error: refusing to update checked out branch: refs/heads/master        
remote: error: By default, updating the current branch in a non-bare repository        
remote: error: is denied, because it will make the index and work tree inconsistent        
remote: error: with what you pushed, and will require 'git reset --hard' to match        
remote: error: the work tree to HEAD.        
remote: error:         
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to        
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into        
remote: error: its current branch; however, this is not recommended unless you        
remote: error: arranged to update its work tree to match what you pushed in some        
remote: error: other way.        
remote: error:         
remote: error: To squelch this message and still keep the default behaviour, set        
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.        
To D:\work\mygit\myproj\sw
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'D:\work\mygit\myproj\sw'

이게 무슨 의미인지 모르겠습니다.
원본으로의 push는 안되는건가요?

rommance.net

lacovnk의 이미지

에러 메시지가 충분히 자세하네요 ㅎㅎ

working copy 그 자체가 저장소죠? 만일 원격의 그 working copy에 push를 해버린다면, 원격의 그 곳에서 작업하던 곳은 어떻게 될까요? 좀 복잡하게 되겠죠..
그렇기 때문에 push를 받는데에는 보통 (working copy 처럼 생긴 repository가 아니라) bare repository를 씁니다.

다음 링크 참고: push to only bare repositories
http://www.gitready.com/advanced/2009/02/01/push-to-only-bare-repositories.html

여기 중간에 나오는 흐름도가 도움이 될 것 같습니다.
http://book.git-scm.com/3_distributed_workflows.html

송지석의 이미지

오 뭔가 복잡하군요
감사합니다. 찾아보면서 공부해야겠군요
rommance.net

bushi의 이미지

case 1, PUSH

[bushi@rose case1]$ GIT_DIR=pub.git git init-db --shared=group
Initialized empty shared Git repository in /home/bushi/net/git-test/case1/pub.git/
[bushi@rose case1]$
[bushi@rose case1]$ git clone file://`pwd`/pub.git priv
Initialized empty Git repository in /home/bushi/net/git-test/case1/priv/.git/
warning: You appear to have cloned an empty repository.
[bushi@rose case1]$
[bushi@rose case1]$ cd priv
[bushi@rose priv]$ ls
[bushi@rose priv]$ echo "test" > test.txt
[bushi@rose priv]$ git add test.txt
[bushi@rose priv]$ git commit -m "test" -s test.txt 
[master (root-commit) 0bc48c2] test
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
[bushi@rose priv]$
[bushi@rose priv]$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 233 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To file:///home/bushi/net/git-test/case1/pub.git
 * [new branch]      master -> master
[bushi@rose priv]$
[bushi@rose priv]$ cd ..
[bushi@rose case1]$ git clone file://`pwd`/pub.git priv_check
Initialized empty Git repository in /home/bushi/net/git-test/case1/priv_check/.git/
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[bushi@rose case1]$ 
[bushi@rose case1]$ cd priv_check/
[bushi@rose priv_check]$ 
[bushi@rose priv_check]$ ls -l
합계 4
-rw-rw-r-- 1 bushi bushi 5 2010-05-10 23:46 test.txt
[bushi@rose priv_check]$ 
[bushi@rose priv_check]$ cd ..
[bushi@rose case1]$ cd priv
[bushi@rose priv]$
[bushi@rose priv]$ git checkout -b priv_debug
Switched to a new branch 'priv_debug'
[bushi@rose priv]$ 
[bushi@rose priv]$ echo "test debug" > test.txt
[bushi@rose priv]$ git commit -m "test2" -s test.txt 
[priv_debug 835e2ef] test2
 1 files changed, 1 insertions(+), 1 deletions(-)
[bushi@rose priv]$
[bushi@rose priv]$ git push origin priv_debug
Counting objects: 5, done.
Writing objects: 100% (3/3), 268 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To file:///home/bushi/net/git-test/case1/pub.git
 * [new branch]      priv_debug -> priv_debug
[bushi@rose priv]$ 
[bushi@rose priv]$ cd ..
[bushi@rose case1]$ cd priv_check
[bushi@rose priv_check]$ git fetch
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From file:///home/bushi/net/git-test/case1/pub
 * [new branch]      priv_debug -> origin/priv_debug
[bushi@rose priv_check]$
[bushi@rose priv_check]$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/priv_debug
[bushi@rose priv_check]$ 
[bushi@rose priv_check]$ cat test.txt 
test
[bushi@rose priv_check]$
bushi@rose priv_check]$ git branch --track priv_debug remotes/origin/priv_debug 
Branch priv_debug set up to track remote branch priv_debug from origin.
[bushi@rose priv_check]$ 
[bushi@rose priv_check]$ git checkout priv_debug
Switched to branch 'priv_debug'
[bushi@rose priv_check]$ 
[bushi@rose priv_check]$ cat test.txt 
test debug
[bushi@rose priv_check]$
[bushi@rose priv_check]$ cd ..
[bushi@rose case1]$

case 2, PULL

[bushi@rose case2]$ svn checkout --username anonsvn <a href="http://kldp.net/svn/nateon" rel="nofollow">http://kldp.net/svn/nateon</a> pub-svn
...
[bushi@rose case2]$ ls -l pub-svn/
합계 12
drwxrwxr-x 4 bushi bushi 4096 2010-05-11 00:30 branches
drwxrwxr-x 5 bushi bushi 4096 2010-05-11 00:30 tags
drwxrwxr-x 9 bushi bushi 4096 2010-05-11 00:30 trunk
[bushi@rose case2]$
[bushi@rose case2]$ git svn clone --tags=tags --branches=branches --trunk=trunk  --username anonsvn <a href="http://kldp.net/svn/nateon" rel="nofollow">http://kldp.net/svn/nateon</a> pub
...
[bushi@rose case2]$ cd pub
[bushi@rose pub]$ git branch -a
* master
  remotes/1.0
  remotes/238_ssl
  remotes/OTPMEMO
  remotes/bug304744_rev130
  remotes/multisession.r286
  remotes/rev141_httpproxy
  remotes/tags/1.0.121
  remotes/tags/1.0.175
  remotes/trunk
  remotes/trunk@119
  remotes/trunk@57
[bushi@rose pub]$
[bushi@rose pub]$ git branch --track multisession.r286 remotes/multisession.r286
Branch multisession.r286 set up to track local ref refs/remotes/multisession.r286.
[bushi@rose pub]$
[bushi@rose pub]$ cd ..
[bushi@rose case2]$ git clone file://`pwd`/pub/.git priv
Initialized empty Git repository in /home/bushi/net/git-test/case2/priv/.git/
remote: Counting objects: 3220, done.
remote: Compressing objects: 100% (3210/3210), done.
remote: Total 3220 (delta 2180), reused 0 (delta 0)
Receiving objects: 100% (3220/3220), 3.28 MiB | 4.62 MiB/s, done.
Resolving deltas: 100% (2180/2180), done.
[bushi@rose case2]$ 
[bushi@rose case2]$ cd priv
[bushi@rose priv]$ 
[bushi@rose priv]$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/multisession.r286
[bushi@rose priv]$ 
[bushi@rose priv]$ git checkout -b priv
Switched to a new branch 'priv'
[bushi@rose priv]$
[bushi@rose priv]$ echo "priv test" > git.txt
[bushi@rose priv]$ git add git.txt 
[bushi@rose priv]$ git commit -m "git test" -s git.txt 
[master 6bb9a3c] git test
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 git.txt
[bushi@rose priv]$ cd ..
[bushi@rose case2]$
[bushi@rose case2]$ cd pub
[bushi@rose pub]$ git remote add -t priv -m priv priv file://`dirname $PWD`/priv/.git
[bushi@rose pub]$ git fetch priv
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From file:///home/bushi/net/git-test/case2/priv/
 * [new branch]      priv       -> priv/priv
[bushi@rose pub]$
[bushi@rose pub]$ git pull priv
Updating f33d549..3279c27
Fast-forward
 git.txt |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 git.txt
[bushi@rose pub]$ 
[bushi@rose pub]$ 
priv test
[bushi@rose pub]$ 
[bushi@rose pub]$ git svn dcommit
Committing to <a href="http://kldp.net/svn/nateon/trunk" rel="nofollow">http://kldp.net/svn/nateon/trunk</a> ...
RA 계층 요청 실패: 서버가 예기치 않은 리턴 값 (403 Forbidden) 을 MKACTIVITY 을/를 '/svn/nateon/!svn/act/ba09d31a-bccd-4e60-9bb3-d2823ac95492'에 요청한 것에 대한 응답으로 보냈습니다 at /usr/libexec/git-core/git-svn line 4265
 
[bushi@rose pub]$

case 3, 언젠가는 머리를 쥐어뜯을 dual

[bushi@rose case3]$ svn checkout --username anonsvn <a href="http://kldp.net/svn/nateon/trunk" rel="nofollow">http://kldp.net/svn/nateon/trunk</a> pub-svn
[bushi@rose case3]$ cp -af pub-svn tmp
[bushi@rose case3]$
[bushi@rose tmp]$ git init --shared=group
Initialized empty shared Git repository in /home/bushi/net/git-test/case3/tmp/.git/
[bushi@rose tmp]$
[bushi@rose tmp]$ git add .
[bushi@rose tmp]$ git commit -m "initial import" -s
...
[bushi@rose tmp]$ cd ..
[bushi@rose case3]$ mv tmp/.git ./pub.git
[bushi@rose case3]$ rm -rf tmp
[bushi@rose case3]$ 
[bushi@rose case3]$ git clone file://`pwd`/pub.git priv
Initialized empty Git repository in /home/bushi/net/git-test/case3/priv/.git/
remote: Counting objects: 819, done.
remote: Compressing objects: 100% (813/813), done.
remote: Total 819 (delta 237), reused 0 (delta 0)
Receiving objects: 100% (819/819), 1.98 MiB, done.
Resolving deltas: 100% (237/237), done.
[bushi@rose case3]$
[bushi@rose case3]$ cd priv
[bushi@rose priv]$ 
[bushi@rose priv]$ ls -al
합계 164
drwxr-xr-x 10 bushi bushi  4096 2010-05-11 01:35 .
drwxrwxr-x  5 bushi bushi  4096 2010-05-11 01:35 ..
drwxrwxr-x  8 bushi bushi  4096 2010-05-11 01:35 .git
drwxrwxr-x  4 bushi bushi  4096 2010-05-11 01:35 .svn
-rw-rw-r--  1 bushi bushi    34 2010-05-11 01:35 AUTHORS
-rw-rw-r--  1 bushi bushi   701 2010-05-11 01:35 BUGS
-rw-rw-r--  1 bushi bushi  1606 2010-05-11 01:35 CMakeLists.txt
...
[bushi@rose priv]$ 
[bushi@rose priv]$ svnversion 
291
[bushi@rose priv]$ 
[bushi@rose priv]$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
[bushi@rose priv]$ 
[bushi@rose priv]$ echo "OTL" > otl.txt
[bushi@rose priv]$ 
[bushi@rose priv]$ svn status
?       .git
?       otl.txt
[bushi@rose priv]$ 
[bushi@rose priv]$ 
[bushi@rose priv]$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	otl.txt
nothing added to commit but untracked files present (use "git add" to track)
[bushi@rose priv]$
[bushi@rose priv]$ find -name .svn -exec mkdir {}/tmp \;
[bushi@rose priv]$
[bushi@rose priv]$ svn add otl.txt 
A         otl.txt
[bushi@rose priv]$ svn commit -m "otl..." otl.txt 
svn: 커밋이 실패하였습니다:
svn: 서버가 예기치 않은 리턴 값 (403 Forbidden) 을 MKACTIVITY 을/를 '/svn/nateon/!svn/act/6f179576-a929-48f6-8a2d-cd659cd68dd4'에 요청한 것에 대한 응답으로 보냈습니다
[bushi@rose priv]$ 
[bushi@rose priv]$ git add otl.txt
[bushi@rose priv]$ git commit -m "otl..." -s otl.txt
[master 357f9ae] otl...
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 otl.txt
[bushi@rose priv]$

OTL

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.