0

my requirement: create a new repo on remote bitbucket repo A and download the existing repo from remote to local i.e repo B . copy all the files from local repo B to local repo A. and push all files from local repo A to remote repo A.

Code :-

//Git localGit = Git.init().setDirectory(localPath).call();
  Git localGit = Git.open(path of local repo A);
         localGit.add().addFilepattern(".").call();
         localGit.commit().setMessage("message").call();
        
         
         
         RemoteAddCommand remoteAddCommand = localGit.remoteAdd();
         remoteAddCommand.setName("origin");
           remoteAddCommand.setUri(new 
                    URIish("https://url/repoA.git"));
              remoteAddCommand.call();
         
         
              PushCommand pushCommand = localGit.push();
              pushCommand.add("master");
              pushCommand.setRemote("origin");
              pushCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider("username", "password"));
              pushCommand.call();

I am not getting any error in the console but still, the files from local repo A to remote repo A are not getting pushed.

Any help would be appreciated

tester
  • 3
  • 2

0 Answers0