How to push to bitbucket using jgit - bitbucket

I am trying to push code to bitbucket using jgit. Clone is working with ssh, but to push - I need to set credentials and I am getting "not authorized " error. I tried username, password, ("Private-token", access-token) and app password also
While pushing after a successful clone, ii am getting "origin not found" error also
Please advise

"Not authorized" might mean that you don't have permissions to push to the specified branch. E.g. there might be a policy to not allow to push directly into main branch. Usually developers should push to feature branches and then submit pull requests to ask for code review before merging to the main branch.
As for "origin not found" please check the remotes. The default name for remote repository is origin, but you might have it differently. Also it might be an issue with the command parameters. Please provide more details.

Related

TFS 2015 Can not Complete Pull Request

I am setting up Pull Request in TFS 2015 GIT Repo. My Users are able to Create Pull Request however I am the only one that is able to Complete a pull request. I have confirmed that all the Users have Contribute to the entire repo. I am at a loss as to what is going on. Once the User Approves the PR and Clicks Complete Pull Request the Button is disabled but it never starts the Merge Process. If the User refreshes the page the Complete Pull Request Button is active again. All of this works fine for me just not any of my other users so I assume it is a permissions issue but can not find it.
In TFS, you could complete your pull request after the reviewers approve of the changes by selecting Complete in the upper right of the pull request view.
Complete button on the pull request view with its drop-down options
After you selected the complete button, it will complete the pull request now and merge the changes to the target branch.
For permissions, you just need to grant Contribute permission of target branch (Pull Request: source branch into target branch) to the corresponding user.
Double check the permission settings, if they are added in some group deny the corresponding permission. In TFS, Deny trumps Allow.
Also make sure your pull request have met all branch policy before the completion.
Pull requests can be completed if the number of required approvals is met, even if other reviewers have rejected the changes.

Unable to Authenticate my Bitbucket server account with Sourcetree / How to register in source tree with Bitbucket Server credentials

I have a Bitbucket repository, which I'm able to logging in web browser with my credentials, Now I want to checkout it in Sourcetree, So I've installed Sourcetree 2.6.10, It requires authentication to Bitbucket server with Root URL & Username to continue, I'm providing input in below format...
Root URL : https://bitbucket.xxxxxxx.com
Username : xxxxxx.xxxxxx
The error i'm getting is...
Failed to check login for user [xxxxx.xxxxxx]. You do not have permission to access URL ‘https://bitbucket.xxxxxxxxx.com/rest/api/1.0/users/xxxxxx.xxxxxx’ please check the user credentials associated with this account. The request returned with status code ‘Unauthorized’.
Any help would be appreciated, thanks !
To fix:
1-go to source tree window, clicked remote
2-little gear icon, clicked "settings"
3-double clicked on Bitbucket server, changed protocol from default HTTPS to SSH
To Perforce, Now, I m sharing another solution whether if the user prefers, BitBucket Cloud intergrated with SourceTree,(facing the above stated issue),
Since one of the steps of the upgrade process was to input your Atlassian account password, you should now have a password set (in addition to being able to use Google). You should be able to use your Bitbucket username and Atlassian account password to authenticate SourceTree.
If you need to reset your Atlassian account password, you can do so here: https://id.atlassian.com/login/resetpassword
Source : https://community.atlassian.com/t5/Bitbucket-questions/Cannot-login-with-Bitbucket-in-SourceTree-after-linking-with/qaq-p/145231
I had a similar problem trying to register Sourcetree the first time I opened it, using my company's Bitbucket Server URL. Turns out I just needed to include https:// at the beginning of the URL.
Drop everything after ".com" and log in there.
e.g. log into
https://bitbucket.xxxxxxx.com
not
‘https://bitbucket.xxxxxxxxx.com/rest/api/1.0/users/xxxxxx.xxxxxx’
see also
https://jira.atlassian.com/browse/SRCTREEWIN-8743

TFS not always emailing pull request notifications

I have a project in TFS. The last two pull requests, we got emails for "xxx has approved the code" but not the subsequent emails for "xxx marked the pull request as completed" The pull requests in question were both approved and completed. The emails do not appear to have been caught in Outlook's spam filter.
The subscription for all projects is "A pull request I created or am a reviewer on is updated"
Version: 15.117.26714.0
Is there a way to diagnose why TFS email notifications are so flaky? This isn't the first complaint I've gotten about TFS email notifications being unreliable.
Have tested TFS 2017.2 instance but could not reproduce the issue on my side. Both approved and completed E-mail sent correctly.
So the issue seems not be able to stable reproduce. For now, there is no way to trouble shoot this directly. You could check the event log in TFS sever to see if you got any error or warning info there.
To narrow down the issue, you could analysis both address the E-mail achieved and sent.
Notifications are sent to your preferred email address, which you can
change from your account preferences. Change the preferred one
and use another to see if issue still exists.
The received notifications are sent by the configured SMTP
server. Try to specify another SMTP Server and the email address
to use for sending emails.
One possibility for this issue, the action of approved and completed pull request were too closely. This may cause TFS only trigger one E-Mail. Do it slowly and try again. Based on my testing, in this case, the E-Mail are sent not in sequence, the completed came first then the approved one.
Moreover, you could also explicitly add a subscription with "A pull request I created or am a reviewer on is updated" just for the project you are working on, which may do the trick.

Unexpected HTTP status code: 403 (-1) Xcode

I have this error when I push my code to Github repository by Xcode
Before answering the question you must know:
Although everyone can make a pull request, you can't just push to a repository. ِِYou need permission.
So this happened for me because in my Xcode, I was pushing to a remote that belonged to one of the other members ie I didn't have permission to push to.
You have two options:
Ask for permission from the owner of that remote repo/fork and have them include into one of its collaborators
Or Simply push to a repo that you have permission like your own repo,
using the dropdown menu encircled below (and perhaps then make a pull request from there to that branch you wanted to push to)
I usually run into this issue when I checkout directly from a remote branch ie I do something like:
git checkout -b localFromUpstream upstream/someBranch
And then when I commit, Xcode assumes that I want to push back to upstream/someBranch. But I don't permission to push to upstream/someBranch.
HTTP code 403 means forbidden, so it is most probably incorrect credentials. So double check your username and password etc.
https://en.wikipedia.org/wiki/HTTP_403
Even you can make a pull request, but can't just push to a repository. ِِYou need permission.
Inviting collaborators to a personal repository
Ask for the username of the person you're inviting as a collaborator. If they don't have a username yet, they can sign up for GitHub.
On GitHub, navigate to the main page of the repository.
Under your repository name, click Settings.
In the left sidebar, click Collaborators.
Under "Collaborators", start typing the collaborator's username.
Select the collaborator's username from the drop-down menu.
Click Add collaborator.
The user will receive an email inviting them to the repository. Once they accept your invitation, they will have collaborator access to your repository.

Didn't get Gerrit review email

I am using Gerrit2.4.2. My account is an administrator, also in Reviewer and Verifier groups(I created these two groups manually).
In All-Projects, I allow Reviewer group to review /ref/* and Verifier to submit /ref/*.
See my diagram below:
We have a project named as appengine. Also have a group called 'appengine team'. This group has two memebers: another developer and me.
Now another developer added a test file and pushed it to HEAD:refs/for/master. But I didn't get any email notification. After he logged into the Gerrit web site and found his change issue.
And added my email manually, I could see the email notification and also could see the change issue in web site.
My project's settings look like so:
Gerrit doesn't send email notifications when a change is uploaded, unless you are watching that project (Settings->Watched Projects). You will also get an email notification if somebody adds you as a reviewer to a change.
My current way is to use one parameter for receive-pack command. I added to my .git/config file:
[remote "review"]
pushurl = ssh://username#IP:29418/myproject.git
push = HEAD:refs/for/master
receivepack = git receive-pack --reviewer csfreebird
Each time a developer uses git push review, I get an email.
Not perfect, Gerrit server should take the responsibility.

Resources