カテゴリー:
Git BASH
閲覧数:173 配信日:2022-10-20 23:45
ローカルリポジトリ(mainブランチ)(の変更)を送信して、リモートリポジトリ(「origin」上の同名ブランチ)へ反映させる
$ git push origin main
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 414.44 KiB | 6.19 MiB/s, done.
Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:GitHubユーザー名/P25-Second-Ranking-Service.git
08bd5d3..aa8864c main -> main
迷走作業失敗履歴
$ git push origin main
To github.com:GitHubユーザー名/P25-Second-Ranking-Service.git
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'github.com:GitHubユーザー名/P25-Second-Ranking-Service.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.
$ git pull origin main
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 640 bytes | 5.00 KiB/s, done.
From github.com:GitHubユーザー名/P25-Second-Ranking-Service
* branch main -> FETCH_HEAD
* [new branch] main -> origin/main
fatal: refusing to merge unrelated histories
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> main
$ git log
commit 260333cb254bdd66b52557fa197e9498c3030d1b (HEAD -> main)
Author: GitHubユーザー名 <★★>
Date: Thu Oct 20 21:43:05 2022 +0900
first commit
$ git push origin main
To github.com:GitHubユーザー名/P25-Second-Ranking-Service.git
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:GitHubユーザー名/P25-Second-Ranking-Service.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> main
$ git branch
* main
$ git pull main
fatal: 'main' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ git pull Default
fatal: 'Default' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ git pull origin main
From github.com:GitHubユーザー名/P25-Second-Ranking-Service
* branch main -> FETCH_HEAD
fatal: refusing to merge unrelated histories
$ git pull origin branch
fatal: couldn't find remote ref branch
$ git pull branch
fatal: 'branch' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ git remote -v
origin git@github.com:GitHubユーザー名/P25-Second-Ranking-Service.git (fetch)
origin git@github.com:GitHubユーザー名/P25-Second-Ranking-Service.git (push)
$ git config --list
http.sslcainfo=L:/9.soft/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager-core
core.longpaths=true
core.autocrlf=false
core.fscache=true
core.symlinks=false
core.fsmonitor=true
pull.rebase=false
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=main
user.name=GitHubユーザー名
user.email=★★
core.autocrlf=false
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
safe.directory=L:/1_Hp/0_sakura/2018server/var
safe.directory=L:/1_Hp/0_sakura/2018server/var/www/html/1-p41
safe.directory=L:/9.soft/Git
difftool.sourcetree.cmd='' "$LOCAL" "$REMOTE"
mergetool.sourcetree.cmd=''
mergetool.sourcetree.trustexitcode=true
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=git@github.com:GitHubユーザー名/P25-Second-Ranking-Service.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
$ git config remote.origin.url
git@github.com:GitHubユーザー名/P25-Second-Ranking-Service.git
$ git status
On branch main
nothing to commit, working tree clean
$ git branch -a
* main
remotes/origin/main
$ git pull branch main
fatal: 'branch' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ git fetch
$ git merge origin/main
fatal: refusing to merge unrelated histories
$ git push origin main
To github.com:GitHubユーザー名/P25-Second-Ranking-Service.git
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:GitHubユーザー名/P25-Second-Ranking-Service.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'github.com:GitHubユーザー名/P25-Second-Ranking-Service.git'
$ git log
commit 260333cb254bdd66b52557fa197e9498c3030d1b (HEAD -> main)
Author: GitHubユーザー名 <★★>
Date: Thu Oct 20 21:43:05 2022 +0900
first commit
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> main
$ git branch --set-upstream-to=origin/<branch> main
bash: branch: No such file or directory
$ git branch --set-upstream-to=origin/ main
fatal: the requested upstream branch 'origin/' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
hint: Disable this message with "git config advice.setUpstreamFailure false"
$ git branch --set-upstream-to=origin/main
branch 'main' set up to track 'origin/main'.
$ git push origin main
To github.com:GitHubユーザー名/P25-Second-Ranking-Service.git
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:GitHubユーザー名/P25-Second-Ranking-Service.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$ git pull origin main
From github.com:GitHubユーザー名/P25-Second-Ranking-Service
* branch main -> FETCH_HEAD
fatal: refusing to merge unrelated histories
$ git pull origin branch
fatal: couldn't find remote ref branch