developer tip

HEAD 기록에서 업스트림 SVN 정보를 확인할 수 없습니다.

optionbox 2020. 12. 8. 07:58
반응형

HEAD 기록에서 업스트림 SVN 정보를 확인할 수 없습니다.


이 오류 메시지가 나타나는 이유는 무엇입니까?


(답변으로 Chad의 "질문"게시, 형식 및 오타 수정)

이 오류 메시지에는 몇 가지 원인이 있습니다.

첫 번째는 가장 일반적입니다. git 저장소에는 두 개의 분리 된 이력이 있습니다 : git에서 만든 기록과 원격 svn 저장소의 기록입니다.

이 문제를 해결하려면 git 저장소와 svn 저장소가 하나의 공통 조상을 공유하도록 만들어야합니다. 그래야 git이 어떤 커밋이 무엇을 변경했는지 파악할 수 있습니다.

다음 문서 에서는 문제 해결 방법에 대해 설명합니다.

문제의 두 번째 가능한 원인은 초기 버전의 git (가능한 경우 Windows msysGit 패키지)이 있고 원격 svn 저장소와 통신하는 새 git 저장소를 방금 생성 한 경우입니다.

예를 들면 :

git svn init svn://svn.xxx.xxx/xxx/trunk
git svn fetch -r BASE:10

또는

git clone svn://svn.xxx.xxx/xxx/trunk // Adds all the files in the revision...

그리고 다음 명령을 사용할 때 다음 오류 메시지가 표시됩니다.

git svn info

작업 트리에서 업스트림 svn 정보를 확인할 수 없습니다.

git svn rebase

업스트림 svn 정보 작업 트리 기록을 확인할 수 없거나

  git svn dcommit

HEAD 기록에서 업스트림 SVN 정보를 확인할 수 없습니다.

위의 오류 메시지가 표시되면 첫 번째 단계는 git 버전을 확인하는 것입니다. (msysGit)에서 내 경우에 있었던 이전 git 버전 <= 1.6.3.3. *을 실행하는 경우 문제를 해결하는 가장 쉬운 방법은 1.6.4. *와 같은 최신 버전의 git로 업데이트하는 것입니다.

다음 기사 에서는 문제에 대해 자세히 설명합니다.


--no-metadata옵션으로 svn repo를 복제하기 때문에이 메시지를 받았습니다 . 아마도 그것은 당신의 문제의 경우이기도합니다.

해당 옵션없이 복제하면 모든 것이 정상입니다.

--no-metadata옵션은 새 git복제본이 향후 표준 소스가 될 때 SVN 저장소를 복제하기 위한 것입니다. git 클론과 SVN 업스트림 간의 차이점을 추적 할 방법이 없기 때문에 SVN 업스트림으로 다시 커밋 할 수있는 용량이 부족합니다.


제 경우에는 svn repo의 HEAD가 git repo의 HEAD와 일치해야합니다. 이렇게 하면 문제가 해결됩니다.

git update-ref refs/remotes/git-svn refs/remotes/origin/master

예를 들어 svn 트렁크에 다른 git 브랜치를 사용하는 경우 svntrunk해당 브랜치를 대신 참조해야합니다. 즉,

git update-ref refs/remotes/git-svn refs/remotes/origin/svntrunk

내가 잘못 추가 한 후 나는이 메시지를 받았습니다 -s/의 --stdlayout받는 매개 변수를 git svn clone않은 서브 버전의 repo에 대한 명령 하지 "표준 서브 레이아웃"의이 trunk, tags그리고 branches상대 경로를.

(보통 복제하는 Subversion 저장소에는 표준 상대 경로가 있으므로 일반적인 git svn clone명령을 사용하여 Subversion 저장소가없는 Subversion 저장소를 복제했을 때이 비밀 메시지가 나타납니다. 메시지는 100 % 정확하지만 거의 100 % 쓸모가 없습니다. 문제가 무엇인지 파악하려고 할 때.)


새로 생성 된 SVN 저장소를 체크 아웃 한 경우에도이 오류가 발생할 수 있습니다.

나는 이것을 해결했습니다.

  1. 먼저 svn 명령을 통해 초기 커밋 수행
  2. 그런 다음 git svn 명령을 사용하여 저장소를 복제하십시오.

동일한 문제가 발생했습니다. http://eikke.com/importing-a-git-tree-into-a-subversion-repository/ 기사를 기반으로 한 솔루션이 있습니다 .

$ git svn init http://server.com/svn/project/trunk/prototypes/proto1/
$ git svn fetch
  W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: '/svn/!svn/bc/100/dcom/trunk/prototypes/ws' path not found
  W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
  This may take a while on large repositories
  r147367 = 37c9910f794cb9cff7ca0d5d2eb26e1f0dabbc4d (refs/remotes/git-svn)
$ svn log http://server.com/svn/project/trunk/prototypes/proto1/
  ------------------------------------------------------------------------
  r147367 | user | 2014-01-16 18:02:43 +0100 (Thu, 16 Jan 2014) | 1 line
  proto1 home
  ------------------------------------------------------------------------
$ git log --pretty=oneline master | tail -n1
  71ceab2f4776089ddbc882b8636aacec1ba5e832 Creating template
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #1

$ git show-ref git-svn
  37c9910f794cb9cff7ca0d5d2eb26e1f0dabbc4d refs/remotes/git-svn
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #2

$ echo "71ceab2f4776089ddbc882b8636aacec1ba5e832 37c9910f794cb9cff7ca0d5d2eb26e1f0dabbc4d" >> .git/info/grafts

$ git svn dcommit
  Committing to http://server.com/svn/project/trunk/prototypes/proto1 ...
    A   README.md
    A   pom.xml
A   src/main/java/.gitkeep
A   src/main/resources/.gitkeep
A   src/main/webapp/WEB-INF/web.xml
A   src/main/webapp/index.html
A   webapps/.gitkeep
  Committed r147419
    A   README.md
    A   pom.xml
A   src/main/java/.gitkeep
A   src/main/resources/.gitkeep
A   src/main/webapp/WEB-INF/web.xml
A   src/main/webapp/index.html
A   webapps/.gitkeep
  r147419 = 6a8bda7262739306d0a6e17eaad2802737dedc35 (refs/remotes/git-svn)
  No changes between current HEAD and refs/remotes/git-svn
  Resetting to the latest refs/remotes/git-svn
  Unstaged changes after reset:
    M   pom.xml
    M   src/main/webapp/index.html
    A   .gitignore
  Committed r147420
    M   pom.xml
    M   src/main/webapp/index.html
    A   .gitignore
  r147420 = 749b5acec55c341672bca08d07de8c336b5a4701 (refs/remotes/git-svn)
  No changes between current HEAD and refs/remotes/git-svn
  Resetting to the latest refs/remotes/git-svn
  ...etc...

이 문제의 또 다른 원인은 잘못된 svn-remote.svn.rewriteRoot옵션입니다 (사용 방법은 이 답변 참조 ).

git-svn-idSubversion에서 가져온 커밋 rewriteRoot이 설정된 경우 URL 과 일치 해야합니다.


git svn init명령에 FQDN을 사용 했지만 기존 git-svn 통합에서 호스트 이름 만 사용했기 때문에이 메시지가 표시되었습니다 .

grep git-svn-id:

git-svn-id: svn://host/repo/...

그러나 나는했다 :

git svn init -Ttrunk svn://host.domain.com/repo

(우리는 svn과 git repo를 정기적으로 동기화하는 머신을 가지고 있으며, 다른 모든 사람들은 git config --add remote.origin.fetch refs/remotes/*:refs/remotes/*svn 동기화 된 브랜치를 가져와야합니다.)


Another possible cause: If you have an svn-remote..rewriteUUID config set, git-svn may have trouble locating the right meta-data for the repository. For example, you might have something like this (see the git-svn man page for a discussion of why you would want to do this):

[svn-remote "svn"]
    url = svn://read-write.test.org
    fetch = trunk/project:refs/remotes/trunk
    rewriteRoot = http://read-only.test.org/svn
    rewriteUUID = 1234-abcd

... where 1234-abcd is the UUID of the read-only mirror. When you 'git svn fetch', you might end up with this file:

.git/svn/refs/remotes/trunk/.rev_map.5678-dcba

... where 56780-dcba is the UUID of the read-write repository. The fix is to:

$ mv .git/svn/refs/remotes/trunk/.rev_map.5678-dcba \
    .git/svn/refs/remotes/trunk/.rev_map.1234-abcd

Can't say for certain whether that is a durable solution, i.e., it might get confused next time you 'git svn fetch'. Might try a symlink rather than 'mv', I haven't experimented with that.


I saw this after I used BFG Repo-Cleaner https://rtyley.github.io/bfg-repo-cleaner/ and rewrited git history (intentional), and then tried to git svn fetch again. The message shows that the git <-> svn matching is lost.

To solves this, read https://git-scm.com/docs/git-svn
At the very bottom shows:

$GIT_DIR/svn/*/.rev_map.

Mapping between Subversion revision numbers and Git commit names. In a repository where the noMetadata option is not set, this can be rebuilt from the git-svn-id: lines that are at the end of every commit (see the svn.noMetadata section above for details).

You need to have the git-svn-id comments in the commit comments to do this. If you do, you can delete the .rev_map.* file and rebuild it.

rm .git/svn/refs/remotes/git-svn/.rev_map.*
git svn info

This should show:

Rebuilding .git/svn/refs/remotes/git-svn/.rev_map.{snip} ...
...
Done rebuilding .git/svn/refs/remotes/git-svn/.rev_map.{snip}
Path: .
...and then regular git svn info output

참고URL : https://stackoverflow.com/questions/1269566/unable-to-determine-upstream-svn-information-from-head-history

반응형