[github 오류 집합] github 분기 문제

4281 단어 일상 응용
github 자주 발생하는 오류 집합
분기 충돌 문제
오류:
fatal: Not a valid object name: 'master'.

오류 원인: 창고를 만들 때 마스터 메인 지점에 파일 REDME가 존재합니다.md 파일,git push 로컬 파일 충돌
klaus@klausMINGW64/d/CODE/Github/day1/2차 제출 테스트(master)
$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin master
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)
$ git push --set-upstream origin master
To https://github.com/klauscf/-git.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/klauscf/-git.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

해결 방법:
1. 로컬 파일을 먼저 add로 로컬 창고 캐시에 저장하고commint는 로컬 창고에 저장합니다.
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)
$ git status
On branch master
No commits yet
Untracked files:
  (use "git add ..." to include in what will be committed)
        ME
        Main/
        README.md
        hh.c
nothing added to commit but untracked files present (use "git add" to track)
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)
$ git add *
warning: LF will be replaced by CRLF in ME.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory

klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)
$ git status
On branch master
No commits yet
Changes to be committed:
  (use "git rm --cached ..." to unstage)
        new file:   ME
        new file:   Main/main.c
        new file:   README.md
        new file:   hh.c
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)
$ git commit -m '      '
[master (root-commit) 7081a85]       
4 files changed, 2 insertions(+)
create mode 100644 ME
create mode 100644 Main/main.c
create mode 100644 README.md
create mode 100644 hh.c
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)

push 파일, 폴더가 일치하지 않음,git 오류
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)
$ git push --set-upstream origin master
To https://github.com/klauscf/-git.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/klauscf/-git.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)

2. 다른 지점을 새로 만들고 다른 지점으로 전환
klaus@klaus MINGW64 /d/CODE/Github/day1/        (master)
$ git checkout -b dev
Switched to a new branch 'dev'
klaus@klaus MINGW64 /d/CODE/Github/day1/        (dev)
$ git push
fatal: The current branch dev has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin dev
klaus@klaus MINGW64 /d/CODE/Github/day1/        (dev)
$ git push -u origin dev
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (5/5), 358 bytes | 119.00 KiB/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'dev' on GitHub by visiting:
remote:      https://github.com/klauscf/-git/pull/new/dev
remote:
To https://github.com/klauscf/-git.git
* [new branch]      dev -> dev
Branch 'dev' set up to track remote branch 'dev' from 'origin'.

지점이 생성되었습니다. 파일을 dev 지점에 업로드합니다.

좋은 웹페이지 즐겨찾기