I am able to clone from GitLab via JGit, but when I go to push the changes, I get a not authorized
error message.
Three more essential details:
I own the repository so it's not an issue with read-only access.
The repository is private so I know the OAuth 2 token is valid and being used in the initial clone.
I ONLY have the username and an oauth2 token. I do not have the user's password, SSH key, or personal access token.
Here is my command for cloning:
Git.cloneRepository()
.setURI(target)
.setDirectory(repoFolder)
.setCloneAllBranches(true)
.setCredentialsProvider(new UsernamePasswordCredentialsProvider("oauth2", token))
.call();
Here is my command for pushing:
PushCommand push = cloneSource.push();
push.setRemote(target);
push.setPushAll();
push.setCredentialsProvider(new UsernamePasswordCredentialsProvider("oauth2", token));
push.call();