ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • linux git 생성 window -> linux git 올리기
    개발 공부/GIT 2022. 3. 2. 15:07
    반응형
    SMALL

    git 생성하기 

     

     linux git 경로에 디렉토리 하나 생성 

    ex) aa.git 

     

    해당 디렉토리 들어가서 

    밑 명령어 실행

    $ git init 
    Initialized empty Git repository in (gitpath)

     

    리눅스에서 git 경로 만든 후에 윈도우에서 해당 프로젝트 올려줌.

     

     

    git 생성할 폴더에서 마우스 우측 클릭하여 git bash here 클릭

    우측클릭했는데 이 메뉴 없으면 git 설치 해야함

     

    git clone ssh://서버 user name@server ip:port/git 디렉토리 경로

    서버 user 이름과 서버아이피, 포트번호 입력후 위에서 생성한 git 디렉토리 경로 넣어서

    위 명령어 입력하면

    해당 폴더에 git 디렉토리와 같은 이름의 폴더 생김

     

    해당 폴더에 프로젝트 통째로 넣기

     

    $ cd git디렉토리명/

    git디렉토리명과 같은 폴더로 들어가서 프로젝트 제대로 들어간지 확인

     

     

    $ git add *

    add 해주면 해당 프로젝트 그대로 git에 add 됨

     

     

    .

    $ git commit
    $ git push

     

    커밋해주고 푸시해주면됨

     


    git push에서 이런 에러 남

     

    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: 'h' configuration variable to 'refuse'.
    To ssh://경로
     ! [remote rejected] master -> master (branch is currently checked out)
    error: failed to push some refs to 'ssh:경로'

     

    git 생성한 linux 서버 git 디렉토리 에서 아래 명령어 실행 후 윈도우에서 다시 git 생성함

    $ git init --bare
    반응형
    LIST

    '개발 공부 > GIT' 카테고리의 다른 글

    GIT push error  (0) 2022.02.08

    댓글

Designed by Tistory.