[git] 로컬 저장소를 리모트 저장소처럼 사용할 수 있나요?

HDNua의 이미지

안녕하세요. git을 이용해 버전 관리를 해보려고 하는데,
잘 안 되는 것이 있어 질문합니다.

1. 먼저 랩탑에서 프로젝트를 생성하고 git init 명령으로 초기화합니다.
2. 그 다음 프로젝트를 통째로 USB에 복사합니다.
3. 프로젝트가 없는 새로운 컴퓨터에 프로젝트를 clone으로 복사합니다.
4. PC에서 프로젝트를 수정하고 커밋합니다.

5. 질문입니다. 그림에 나온대로, 생성한 작업물을 USB에 커밋하는 방법과,
USB에 수정된 버전으로 Laptop의 프로젝트를 업데이트 하고 싶습니다.
그리고 두 프로젝트가 충돌할 때 diff라는 명령을 쓴다는데,
이에 관해 자세히 소개된 튜토리얼이 있는지 궁금합니다.

읽어주셔서 감사합니다.

-----

이 글은 다른 커뮤니티에 올린 질문을 복사한 것입니다.
제목은, 협업을 위해서는 리모트 저장소가 필요하며 로컬 저장소만으로는 불가능하다는 답변을 받아서 확인차 올렸습니다.

File attachments: 
첨부파일 크기
Image icon 1.jpg22.06 KB
Image icon 2.jpg27.63 KB
Image icon 3.jpg35.38 KB
Image icon 4.jpg29.69 KB
Image icon 5.jpg38.17 KB
neocoin의 이미지

git --bare init

이 명령어를 출발점으로 방법을 찾아보세요.

HDNua의 이미지

git bare init으로 네이버에서 검색해서 이런 링크를 찾았습니다.
http://www.whatwant.com/328

repository가 bare로 설정되면 해당 repository는 서버 전용이 되어
수정 작업은 불가능해지는 것 정도로 이해했습니다.
제가 git을 공부를 따로 한 게 아니라 사용법만 골라 읽고 있었는데,
그렇게 쓸만큼 git이 단순한 도구가 아닌 모양이네요.

일단 kayws426님이 알려주신 git push, git pull 키워드를 중심으로 찾고 있습니다.
bare 관련해서는 좀 더 내공이 쌓이면 다시 봐야겠습니다.
다시 한 번 소중한 답변에 감사드립니다.

저는 이렇게 생각했습니다.

Anti-Lock의 이미지

5번그림에서
git push
git pull
이 해답입니다.

HDNua의 이미지

먼저 PC에서 git push를 단순하게 입력했습니다.
이런 메시지가 뜨더군요.

$git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
 
  git config --global push.default matching
 
To squelch this message and adopt the new behavior now, use:
 
  git config --global push.default simple
 
when push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
 
In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
 
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
 
Counting objects: 57, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28/28), done.
Writing objects: 100% (31/31), 1.90 MiB | 3.37 MiB/s, done.
Total 31 (delta 17), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: ...
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To k:/univ/2-2/dev/ds/Assignment1/.git
 ! [remote rejected] master -> master (branch is currently checked out),
error: failed to push some refs to 'k:/univ/2-2/dev/ds/Assignment1/.git'

처음에는 rejected 해결 방법을 찾으려고 이런 포스트를 봤습니다.
http://lejpower.blog.me/220288046785

rejected되면 branch를 새로 만든 다음 master와 merge해보라는 것인데,
실제로 해봤더니 이렇게 나왔습니다.

$ git branch temp1 // temp1 브랜치를 생성합니다.
...
$ git checkout temp1 // temp1 브랜치로 이동합니다.
...
$ git pull origin +master:temp1 // 음... 뭔지 모르겠습니다. master에서 temp1으로 가져온다??
...
$ git checkout master // master 브랜치로 이동합니다.
...
$ git merge temp1 // temp1 브랜치와 병합합니다.
Already up-to-date.

여기서 push를 다시 시도했는데 결과는 다르지 않네요.
혹 어디가 잘못되었는지 조언해주시면 감사하겠습니다.

저는 이렇게 생각했습니다.

peecky의 이미지

http://seapy.com/1747 이 글 참고해보세요. Dropbox를 USB라 보면 될 듯 합니다.

HDNua의 이미지

아주 편리해보이네요. 이 방법도 써봐야겠습니다.
좋은 정보 감사합니다.

저는 이렇게 생각했습니다.

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.