다른 드라이브를 내에 각각 local과 remote폴더를 만든다.
(같은 드라이브 내 생성 시 문제발생)
remote폴더에서 아래와 같이 주소창 클릭 후 cmd타이핑 후 뜨는 cmd창에서 code . 타이핑
그 다음 점 세 개 클릭 후 terminal 클릭
shine@shine MINGW64 /d/remote (master)$ git initReinitialized existing Git repository in D:/remote/.git/
shine@shine MINGW64 /d/remote (master)$ vim f1.txt
shine@shine MINGW64 /d/remote (master)
$ git add f1.txt
warning: in the working copy of 'f1.txt', LF will be replaced by CRLF the next time Git touches it
shine@shine MINGW64 /d/remote (master)
$ git commit -m "a"
[master (root-commit) 6a2bc6d] a
1 file changed, 1 insertion(+)
create mode 100644 f1.txt
shine@shine MINGW64 /d/remote (master)
$ ls -al
total 9
drwxr-xr-x 1 shine 197121 0 11월 14 16:48 ./
drwxr-xr-x 1 shine 197121 0 11월 14 16:45 ../
drwxr-xr-x 1 shine 197121 0 11월 14 16:48 .git/
-rw-r--r-- 1 shine 197121 2 11월 14 16:48 f1.txt
shine@shine MINGW64 /d/remote (master)
$ git log
commit 6a2bc6d2ab5071ed7d52d91c9bfe8c3572608504 (HEAD -> master)
Author: jiyoung <jiyoung.byun@quest-global.com>
Date: Mon Nov 14 16:48:35 2022 +0900
a
local폴더에서 주소창 클릭 후 cmd타이핑 후 뜨는 cmd창에서 code . 타이핑
후 점 세 개 클릭하여 terminal 생성
shine@shine MINGW64 ~/Desktop/local
$ git init
Initialized empty Git repository in C:/Users/shine/Desktop/local/.git/
shine@shine MINGW64 ~/Desktop/local (master)
$ git pull
There is no tracking information for the current branch.Please specify which branch you want to merge with.See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=<remote>/<branch> master
shine@shine MINGW64 ~/Desktop/local (master)
$ git pull D:\remote master
remote: Enumerating objects: 3, done.remote: Counting objects: 100% (3/3), done.remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 190 bytes | 14.00 KiB/s, done. From D:remote * branch master -> FETCH_HEAD
shine@shine MINGW64 ~/Desktop/local (master)$ git logcommit 6a2bc6d2ab5071ed7d52d91c9bfe8c3572608504 (HEAD -> master) Author: jiyoung <jiyoung.byun@quest-global.com>Date: Mon Nov 14 16:48:35 2022 +0900
a
shine@shine MINGW64 ~/Desktop/local (master)
$ vim f1.txt
shine@shine MINGW64 ~/Desktop/local (master)
$ git add f1.txt
shine@shine MINGW64 ~/Desktop/local (master)
$ git commit -m "ab"
[master 3307731] ab
1 file changed, 1 insertion(+), 1 deletion(-)
shine@shine MINGW64 ~/Desktop/local (master)
$ git log
commit 33077310de405dd949007d9d711c671464fb1dc5 (HEAD -> master)
Author: jiyoung <jiyoung.byun@quest-global.com>
Date: Mon Nov 14 17:21:39 2022 +0900
ab
commit 6a2bc6d2ab5071ed7d52d91c9bfe8c3572608504
Author: jiyoung <jiyoung.byun@quest-global.com>
Date: Mon Nov 14 16:48:35 2022 +0900
a
shine@shine MINGW64 ~/Desktop/local (master)
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote re pository using
git remote add <name> <url>
and then push using the remote name
git push <name>
shine@shine MINGW64 ~/Desktop/local (master)
$ git remote add remote D:\remote
shine@shine MINGW64 ~/Desktop/local (master)
$ git push remote
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream remote master
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
shine@shine MINGW64 ~/Desktop/local (master)
$ git push --set-upstream remote master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 241 bytes | 241.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
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: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behaviour, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To D:remote
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'D:remote'
shine@shine MINGW64 ~/Desktop/local (master)
$ git init --bare
Initialized empty Git repository in C:/Users/shine/Desktop/local/
shine@shine MINGW64 ~/Desktop/local (master)
$ git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
shine@shine MINGW64 ~/Desktop/local (master)
$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream remote master
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
shine@shine MINGW64 ~/Desktop/local (master)
$ git push --set-upstream remote master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 241 bytes | 241.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
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: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behaviour, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To D:remote
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'D:remote'
shine@shine MINGW64 ~/Desktop/local (master)
$ git init --bare
Reinitialized existing Git repository in C:/Users/shine/Desktop/local/
shine@shine MINGW64 ~/Desktop/local (master)
$ git config --bool core.bare true
shine@shine MINGW64 ~/Desktop/local (master)
$ git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
shine@shine MINGW64 ~/Desktop/local (master)
$ git origin
git: 'origin' is not a git command. See 'git --help'.
shine@shine MINGW64 ~/Desktop/local (master)
$ git remote -v
remote D:remote (fetch)
remote D:remote (push)
shine@shine MINGW64 ~/Desktop/local (master)
$ git push remote master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 241 bytes | 241.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
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: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behaviour, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To D:remote
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'D:remote'
.................................
shine@shine MINGW64 ~/Desktop/local (master)
$ git config --bool core.bare true
shine@shine MINGW64 ~/Desktop/local (master)
$ git init --bare
Reinitialized existing Git repository in C:/Users/shine/Desktop/local/
shine@shine MINGW64 ~/Desktop/local (master)
$ git config --global receive.denyCurrentBranch updateInstead
shine@shine MINGW64 ~/Desktop/local (master)
$ git pull --all --prune
fatal: this operation must be run in a work tree
shine@shine MINGW64 ~/Desktop/local (master)
$ git config core.bare true
shine@shine MINGW64 ~/Desktop/local (master)
$ git config --bool core.bare true
shine@shine MINGW64 ~/Desktop/local (master)
$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream remote master
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
shine@shine MINGW64 ~/Desktop/local (master)
$ git push --set-upstream remote master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 241 bytes | 241.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To D:remote
6a2bc6d..3307731 master -> master
branch 'master' set up to track 'remote/master'.
shine@shine MINGW64 /d/remote (master)
$ git log
commit 33077310de405dd949007d9d711c671464fb1dc5 (HEAD -> master)
Author: jiyoung <jiyoung.byun@quest-global.com>
Date: Mon Nov 14 17:21:39 2022 +0900
ab
commit 6a2bc6d2ab5071ed7d52d91c9bfe8c3572608504
Author: jiyoung <jiyoung.byun@quest-global.com>
Date: Mon Nov 14 16:48:35 2022 +0900
a
git push확인 완료.