네트워크 통신

깃(git) - git bash 폴더 업로드

@blackcat 2022. 12. 1. 13:06

# 선택 폴더 깃 배쉬

$ git init   // 초기화

$ git remote add origin [repository add]     // 깃 레파지토리 주소 연결

$ git status

$ git add .    // 'add' 뒤에 공백 한칸 추가 후  '.' 

$ git commit m “commit log”

$ git remote v

$ git push origin master

 

# 에러 src refspec master does not match any

원인은 repository 정보가 변경되었을 때 나타나거나

다른 곳에서 clone repository 를 내 repository 로 새로 만들어서 push 할 때 발생된다. git 정보가 틀어져서 그런거니 git 정보를 초기화 해준다.

$ git init

$ git add .

$ git commit -m "init"

$ git remote add origin [Github repository Address]

$ git push -u origin main

 

만약 master 브랜치가 없어서 발생하는 오류일 경우
$ git checkout -b 'master'
$ git push origin master

 

 

# 에러 Remote origin already exists

에러는 기존에 연결되어 있는 레파지토리가 다시 새로운 레파지토리에 소스코드를 올리려고 하면 발생되는 에러입니다.

$ git remote remove origin

 


참고사이트
https://vanillacreamdonut.tistory.com/193
https://0ver-grow.tistory.com/1102