코랩으로 깃허브 블로그 처음 만들기

ganadara·2023년 5월 17일
1

github

목록 보기
3/4

os

  • Windows 10
  • colab

오류 해결

개인토큰 발행안하고 바로 colab에서 git했더니 계정인증문제 발생함
개인토큰을 발행후 colab과 github연동할 수 있다는 블로그를 보고 개인토큰 발행후 colab과 github 연결해서 오류 해결함

colab과 github 연동

  • 개인토큰 발행방법: github - Settings - Developer settings - tokens - Generate new token

code


# 구글 드라이브 연결
from google.colab import drive
drive.mount('/content/drive')

# 폴더이동
cd /content/drive/MyDrive/Commit_test_folder

# git clone
!git clone https://사용자이름:개인토큰@github.com/사용자이름/레파지토리이름.git

# 폴더이동
cd danakkii.github.io

# 사용자인증
!git config --global user.email 이메일
!git config --global user.name 사용자이름

# 파일생성
!echo "Hello World" > index.html

#git push
!git add --all
!git commit -m "Initial commit"
!git push -u origin main

결과

profile
DL 공부중

1개의 댓글

comment-user-thumbnail
2023년 5월 18일

🐇

답글 달기