2013-05-30 6 views
0

저는 며칠 동안이 주제를 검색해 왔으며 해결책을 찾지 못했습니다. 나는이 주제도 살펴 봤다. StackOverflow How to push JGitJGit 푸시가 파일을 업데이트하지 않습니다.

문제는 내가 아주 기본적인 기능만을 가진 github이어야하는 프로그램을하고 있지만, 푸시 커밋 메시지가 잘 작동하지만 변경하면 원격 저장소에서 업데이트되지 않는 일부 파일의 내용.

나는이 커밋 사용 :

Repository localRepo = new FileRepository(repository + "\\.git"); 
Git git = new Git(localRepo); 
git.commit().setCommitter(txtCommiter.getText(),"").setMessage(txtCommit.getText()).call(); 

을 그리고 밀어 위해 이것을 사용

Repository localRepo = new FileRepository(this.repository + "\\.git"); 
Git git = new Git(localRepo); 
PushCommand push = git.push(); 
UsernamePasswordCredentialsProvider user = new UsernamePasswordCredentialsProvider(this.userName, this.pwd); 
push.setCredentialsProvider(user); 
push.setRemote(this.remote); 
push.call(); 

사람은 내이 도움을 줄 수?

답변

3

만들고있는 커밋이 git show COMMIT_ID을 사용하여 올바른지 확인하십시오.

그렇지 않은 경우 커밋 할 파일을 CommitCommand과 함께 포함하지 않은 것이 문제입니다. git commit -a -m msg에 다음과 같은 대응은 :

git.commit().setAll(true).setMessage(msg).call(); 

또한 커밋에서 특정 파일이나 디렉토리를 포함 setOnly(path)를 사용할 수 있습니다. 둘 이상의 경로에 대해 여러 번 호출하십시오.

커밋 (커밋에 다음 파일을 지정할 필요가 없습니다)를 위해 먼저 무대에 인덱스에 파일을 추가하면 또 다른 옵션은 다음과 같습니다

git.add().addFilepattern(dirA).addFilepattern(fileB).call(); 
+0

가 robinst 감사 문제였다 커밋에 setAll() 메서드가 없습니다. – Taka

관련 문제