git add main.texgit commit -m "Add a line from Git"git push
출력의 마지막 줄에 이동한 브랜치가 표시됩니다.
53aca61..db007e3 main -> main
변경 사항이 편집기에 나타나고, 열려 있는 편집기는 자동으로 업데이트됩니다. 새 파일, 폴더, 이름 변경은 파일 트리에 표시됩니다. History에서는 변경 사항에 You (via Git)라고 표시됩니다. 커밋 메시지는 그곳에 표시되지 않습니다.
프로젝트 기록의 push
Git이 push를 거부하는 경우
그사이 프로젝트가 변경되었으면 Git이 push를 거부합니다.
! [rejected] main -> main (fetch first)
먼저 그 변경 사항을 가져온 다음 다시 push합니다.
git pull --no-rebase --no-editgit push
일반 git pull은 fatal: Need to specify how to reconcile divergent branches.와 함께 멈출 수 있습니다. 위의 --no-rebase 옵션이 이를 해결하며, 양쪽을 병합합니다.양쪽에서 같은 줄이 변경되었으면 pull이 CONFLICT (content): Merge conflict in main.tex와 함께 멈춥니다. 파일을 수정한 다음 실행합니다.
git add main.texgit commit -m "Merge the changes from the editor"git push
사이트가 받아들이지 않는 것이 두 가지 있습니다.
다른 브랜치: ! [remote rejected] feature -> feature (wrong branch). main만 존재하므로 작업을 그곳에 push하세요.
강제 push: ! [remote rejected] main -> main (forced push prohibited). 대신 현재 main 위에 변경 사항을 올리세요.
Git이 Authentication failed라고 하는 경우
remote: Enter your Git authentication token when prompted for a password.fatal: Authentication failed for 'https://<your-site>/git/<project-id>/'
토큰이 잘못되었거나 삭제되었거나, 계정 비밀번호를 입력했습니다. 기존 토큰은 다시 볼 수 없으므로, 토큰이 더 이상 없다면 새 토큰을 만드세요.
토큰 삭제하기
Account settings의 Git integration에서 토큰 옆의 삭제 아이콘을 클릭한 다음, 대화 상자에서 Delete를 클릭합니다. 그 후 Git은 해당 토큰에 Authentication failed로 응답합니다.