본문 바로가기

Programming/flutter

[Github] VScode를 통해서 github에 올리기

github에서 new repository를 생성하고 파일을 올리니 master branch에만 올라가고 main으로 넘어가지가 않았다.

 

따로 main으로 올라갈 수 있게 설정하는 방법도 있지만 이를 설정하기가 번거로움 때문에

 

vscode에서 바로 repository를 생성하고 commit 하는 방법에 대해서 적어두고자 한다.

 

 

1. vscode에서

 

 

의 버튼을 클릭한다. 그리고 github에 새로운 repository 생성을 클릭해서 생성한다.

 

그 뒤 github에 들어가면 다음과 같은 내용을 따라 가면 된다.

 

echo "# 'readme'에 작성할꺼" >> README.md

git init

git add README.md

git commit -m "first commit"

git branch -M main

git remote add origin (자신의 주소)

git push -u origin main

 

이렇게 따라가면 깔끔하게 master branch가 아닌 main branch에 올라가게 된다. 

 

그 다음엔

git init

git add .

git commit -m "comment 작성 내용"

git branch-M main

git push -u origin main

 

-------------

다시 push를 하고 싶을 때는

git pull origin main으로 땡겨오고 나서 push를 해야한다. 

 

'Programming > flutter' 카테고리의 다른 글

[flutter] state management - GetX  (0) 2021.07.07
[flutter] State mangement : Provider  (0) 2021.07.01
[flutter] ios firebase 연동 문제  (0) 2021.06.29
[flutter] ios firebase 연동  (0) 2021.06.29
[Flutter] Firestore  (0) 2021.06.29