push

canyi·2023년 4월 18일
0

github

목록 보기
6/15

push

로컬 저장소의 내용을 원격 저장소로 업로드

New repository 클릭


이름 만 생성하고 Create repository

새로운 리퍼지토리를 만들경우 아래 명령어를 사용

…or create a new repository on the command line
echo "# git_test" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/piaocanyi1997/git_test.git
git push -u origin main

기존에 있는 리퍼지토리에 원격저장소만 추가하고 싶다

…or push an existing repository from the command line
git remote add origin https://github.com/piaocanyi1997/git_test.git
git branch -M main
git push -u origin main

commit && push

로컬 commit

mkdir 폴더 > cd 폴더 > git init > touch 파일.확장자 > git 파일.확장자 > git commit -m "주석"

git push [alias][branch]

git remote -v > git push -u origin 브런치 

error: failed to push some refs to 'https://github.com/piaocanyi1997/git_test'

push 를 못한다는 에러가 발생하는데

방법1 :

git push -u origin head:main

head 를 통해 main 브런치로 push한다. (head:현재 어떤 작업 공간에 있는지 가리킴)

방법 2:

pull을 먼저 하고 push를 하는건데 나는 이 방법이 통하지 않은거 같다.

profile
백엔드 개발 정리

0개의 댓글