I use SourceTree with a local Mercurial server, the problem is that SourceTree is asking to authenticate at each operation. By example, for a clone it can be 10 times entering user/pwd ...
Though, I enter user/pwd and checked the "remember" checkbox, it continue to ask.
I have see that I can use SSH, but I have no access to the repository web page (it is a local server) to setup the SSH key.
1 - I tried to setup an account in SourceTree using Options>Authentication
Using the option "Bitbucket server" and entering our server URL. In fact, with this method I can even enter my password, it just failed !
2 - By using an URL like this : https://username:password#serverurl
3 - Using the Windows Credentials Manager !
4 - I edited the .hgrc file
Does someone has an idea ?
I was unable to solve the issue, then I use TortoiseHG and this tool works !
So, it looks like a bug in SourceTree !
You can also switch for SourceTree version 1.6.23, this one will work.
This solution on the Atlassian Community solved the issue for me (edited for typos and clarity):
For all who are using SourceTree under Windows OS and Mercurial as Versioning tool and want to get rid of the boring popup asking for your credentials:
Start cmd shell as admin
Change path to where git-credential-manager.exe as been installed (normaly under ~\AppData\Local\Atlassian\SourceTree\git_extras)
Call "git-credential-manager.exe store"
In the next lines fill in:
protocol=https
host=code.domain.name
username=yourLoginName
password=yourLoginPassword
Press return again for a new empty line. If you don't get any message, everything is okay.
Related
I can't seem to create a project from a url when using TeamCity. I am hosting my code on bitbucket using mercurial. When I enter the repository URL, I get this error:
Cannot create a project using the specified URL. The URL is not
recognized.
My url looks like this:
https://logeyg#bitbucket.org/logeyg/tracs-enhancements
And I am of course supplying a username and password. I have tried removing the 'logeyg#' but that doesn't work either.
Did you try SSH URL? What exact version of TC do you use?
There were some fixes in 9.0.2 version (https://youtrack.jetbrains.com/issue/TW-39730), maybe it is also for BitBucket.
Btw. I've just tried with internal Git repo and it works fine with both HTTPS and SSH protocols. Maybe there is a problem with BitBucket itself.
There is a ticket suggi(https://youtrack.jetbrains.com/issue/TW-48788) suggesting mercurial may not be installed.
Ensure mercurial is installed (https://www.mercurial-scm.org/)
Try https://bitbucket.org/logeyg/tracs-enhancements/src without the username and add /src
Check the Admin-> Diagnostics -> Server Logs -> teamcity-vcs
This will provide more info eg. invalid credentials, hg not installed.
If your using bitbucket. Use the clone project URL. Once you do that the "create project URL" in TC will auto detect everything. I user Https and not ssh. Thanks
I'm running Lion latest with SourceTree.
I tried to connect to a Fogbugz Kiln reponsitory, which succeeded, but whenever I PUSH or PULL Sourcetree consistently asks me for a username and password despite I saved it to my KeyChain. Anyone have any insight to this issue?
This helped me solve this issue in a mac:
Open the Hosted Repositories window by clicking View > Show Hosted Repositories or Command + Shift + H.
Click Edit Accounts
Double-click on your account
Click Set Password
I had the same and I fixed it using the system git instead of the embedded one:
Settings -> git -> Use System git
Open terminal and Type git config --global credential.helper osxkeychain
Allow access when asked. Make a pull from sourcetree, you may have to enter password one more time after that it wont ask again from next time onwards.
PS: This solution is only for Mac OS
I occasionally run into the same problem. None of the methods listed here actually helped me out, but after I restart my computer, I am again able to do as I please with SourceTree and git.
Nevertheless this issues is annoying as hell and seeing that Atlassian haven't resolved it in over 3 years, since the original question was posted, is even more unnerving.
I had the same problem and it troubled me for a long time, but I found a solution:
Go to terminal in your project folder.
Run #git pull
Input your username and password
Go back to sourceTree and run Fetch or Pull, it does not ask for your password again.
I met the same problem, what I did is
Open Keychain Access
Find the corresponding keychain entry for your repo, and double click to open (e.g. the entry with name github.com)
Click the 'Access Control' tag
Select 'Allow all applications to access this item' and save changes
This solves the problem (or at least for me), but in some sense makes it less secure though.
As said by Laurens in the comment, you can file an issue with us via jira.atlassian.com (project SRCTREE). It shouldn't constantly ask for authentication if you've saved your credentials to the keychain unless there's an authentication problem.
Cheers
Wasted 90 minutes on all this. Sourcetree simply would not let me remove my account and add it back. Finally uninstalled and downloaded an older version:
https://www.sourcetreeapp.com/download-archives
ver 1.10 fixed all my issues:
After installing and playing around with mercurial , I am trying to get Hudson to clone the repository so it can build my project.
At the moment the following task works.
I Can sync to my external host and the code shows up on that host.
Now I am trying to configure hudson / jenkins to access the code on my host.
But unfortunately I am rolling on a error:
Started by user anonymous
$ hg clone --rev default https://bitbucket.org/*/testproject "F:\Hudson\jobs\testproject\workspace"
abort: http authorization required
ERROR: Failed to clone https://bitbucket.org/*/testproject
[workspace] $ hg log --rev . --template {node}
java.io.IOException: Cannot run program "hg" (in directory "F:\Hudson\jobs\testproject\workspace"): CreateProcess error=267, The directory name is invalid
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:698)
at hudson.Launcher$ProcStarter.start(Launcher.java:329)
at hudson.Launcher$ProcStarter.join(Launcher.java:336)
at hudson.plugins.mercurial.MercurialSCM.joinWithPossibleTimeout(MercurialSCM.java:298)
at hudson.plugins.mercurial.HgExe.popen(HgExe.java:191)
at hudson.plugins.mercurial.HgExe.tip(HgExe.java:171)
at hudson.plugins.mercurial.MercurialSCM.calcRevisionsFromBuild(MercurialSCM.java:254)
at hudson.scm.SCM._calcRevisionsFromBuild(SCM.java:304)
at hudson.model.AbstractProject.calcPollingBaseline(AbstractProject.java:1186)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1175)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:523)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:418)
at hudson.model.Run.run(Run.java:1362)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 18 more
Finished: FAILURE
What actions do i need to do to tell Hudson to use username x and password y to acces the data?
Edited => Found how to integrate ssh .
Used SSH instead of https
Download putty.exe, puttygen.exe, pageant.exe, and plink.exe from the PuTTY website.
Start puttygen and generate a key in OPENSSH FORMAT (hudsons format) (=> How to use Svn + SSH )
Click the Save private key button and save the .PPK file somewhere.
Click the Save public key button and save it.
Go to your website and enter the public ssh-key
Run pageant.exe. The pageant icon (a computer wearing a hat) will show up in the status tray.
Right-click the pageant icon and choose Add Key.
Choose the .PPK file you saved earlier and type in its passphrase.
The following (end part is copied) from Ted Naleid (Thank you!) blog witch can be found here : Hooking up hudson to your ...
Install the Mercurial plugin in Hudson
All that’s left to do now is install
the Mercurial plugin in hudson. In a
browser, go to
http://INSERT_YOUR_IP_HERE:8080.
Hudson should come up.
Click on “Manage Hudson” and go to
“Manage Plugins”. Go to the
“Available” tab, check “Hudson
Mercurial plugin” and hit the
“Install” button. Hudson will prompt
you to restart, and then it’s
installed.
After that, just create a new job and
you’ll have a new “mercurial” option
in the “source control management”
section. Select that and put the ssh
URL in the “Repository URL” field.
Then put “default” in the “branch”
field and set up the rest of the job
to build/test your code (an exercise
left to the reader).
and here it is the first succesfull build !
Conclusion : This is a summary of all the small blogpost scattered arround the internet. I hope this post helps you in starting hudson and mercurial.
I think the problem is not related to username and password. Your stacktrace tells you there's something wrong with the path F:\Hudson\jobs\testproject\workspace.
Cannot run program hg (in directory
"F:\Hudson\jobs\testproject\workspace")
The directory name is invalid
Anyway, you can specify the username and password in the URL like: http://user:password#mydomain.org.
To authenticate the Jenkins/Hudson Mercurial plugin with BitBucket I too found it useful to use the SSH protocol instead of HTTPS particularly since:
there doesn't seem to be a way to store your HTTPS credentials to BitBucket with the Mercurial Jenkins plugin, but with SSH you can safely and securely store your credentials
with SSH you can configure it to use compression, which Mercurial doesn't do natively.
Good instructions for setting up SSH access to BitBucket are available here: http://confluence.atlassian.com/display/BITBUCKET/Using+SSH+to+Access+your+Bitbucket+Repository
Notes:
If you are running Jenkins/Hudson on a *nix server, you will want to login as the user running the Jenkins process and perform these operations from that users home directory, so the configurations will be found by that user (e.g. on my Debian server installation of Jenkins standalone, the user 'jenkins' is created and the home directory is set to '/var/lib/jenkins' [not /home/jenkins] - where I performed the instructions provided at the above link).
I found it very helpful to assure the hg clone command worked from the command line before attempting to have Jenkins call it.
IMPORTANT: In order to get this to work, I had to generate a key ** without ** a passphrase.
You can add the following lines to jenkins .hgrc file (usually /var/lib/jenkins/.hgrc)
[auth]
bitbucket.prefix = https://bitbucket.org/your_user/...
bitbucket.username = your_user
bitbucket.password = ******
See http://www.selenic.com/mercurial/hgrc.5.html#auth
You can add your scm credentials in the 'Credentials` section of Jenkins:
Also change the job configuration to use the credentials:
At home, this works perfectly. I'm on another computer now (using cygwin) and hg push will not prompt for a username / password:
user#localhost /cygdrive/d/repos/upthescala/viewprotect
$ hg push https://viewprotect.googlecode.com/hg/
pushing to https://viewprotect.googlecode.com/hg/
searching for changes
abort: http authorization required
Here are the contents of my ~/.hgrc:
[http_proxy]
host=someproxy:8080
[ui]
username = My Name <myemail>
Thanks in advance for any advice!
Note: this seems to be a cygwin problem. When I try from the Windows prompt (cmd.exe), it works as expected:
D:\repos\upthescala\viewprotect>hg push https://viewprotect.googlecode.com/hg/
pushing to https://viewprotect.googlecode.com/hg/
searching for changes
http authorization required
realm: Google Code Mercurial Repository
user: myemailaddress
password: *********
remote: Success.
--
LES
This could be caused by using a version of Mercurial that's tied to the Windows console subsystem. The binary distributed with Tortoise falls into this category. If this is the case, mercurial is expecting to use the console subsystem to prompt for credentials, but it does not find it when run from the Cygwin shell. In my case, installing and using the Cygwin version of mercurial fixed the problem, in addition to fixing color output. To check which version you're using, run 'which hg' (but you probably already knew that).
To add to Andrew's comment:
installing and using the Cygwin version of mercurial fixed the problem,
This also fixed the problem for me, but it caused another problem which took me some time to figure out. When using the Cygwin version of hg, all files that had been cloned under TortoiseHG showed up as modified when I ran hg status, but no differences were shown for any of them when I ran hg diff.
The problem was that the permissions didn't match. Running chmod 644 .* -R in each repo resolved this problem.
Since it's HTTP you can always put the username and password right in the URL. That works on any website using http auth and in any browser.
hg push https://myemailaddress:*********#viewprotect.googlecode.com/hg/
Alternately, newer Mercurial versions have an auth section you can use.
BTW, that's a terrible password. You should come up with something better than eight stars.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Continuous Integration stack on Windows with Mercurial + Mercurial Queues?
If so, what does your build process look like?
I'm having a difficult time (mostly because of my lack of experience/understanding of all 3 tools) getting TeamCity to run my FinalBuilder scripts. Right now I have FinalBuilder managing all the source control checkouts and TeamCity basically just running the FinalBuilder script and reading in the NUnit test results, but it doesn't work due to authentication errors while executing mercurial commands to kiln.
If you've installed the Kiln Client on the machine running your FinalBuilder script, you'll have access to the "kilnauth" mercurial extension that should solve this problem for you.
Just log on to the build machine as the user that runs the FinalBuilder script and manually execute one push or pull command from the Mercurial repository you're trying to use, you'll be asked to authenticate. Authenticate once, and the Kiln Client extensions will remember this authentication for this user...and any subsequent runs by the FinalBuilder script should authenticate just fine.
Does this solve the problem for you? It's the best solution as it doesn't store any username or password on your machine. There are obviously other possibilities, like changing the path of your Mercurial to use the format http://{username}:{password}#{kiln url}...but this isn't as nice or safe as the technique above.
Does this make sense?
I don't know anything about Kiln, but I've just started working for VSoft and am working on a Mercurial action for the next version of FinalBuilder. Hopefully some of this will help.
Are you athenticating via SSH or SSL? Can you pull/push to the repository from the command line? Pretty much anything you can get to work from the command line should be possible with FinalBuilder.
To authenticate to BitBucket via SSH, I did the following:
download puttygen and pageant
create a new SSH key in puttygen
add the private key to pageant
add the public key to BitBucket
From there, I can successfully
hg push ssh://hg#bitbucket.org/user/repo
NB, I also have TortoiseHG installed, and Mercurial is using TortoisePlink as the ssh client.
If you're using SSL, you can store the username/password combo in your FinalBuilder action. To turn a TextEdit box into a password field, change the PasswordChar property from #0 to *. Then in the ReadData event, add something like
Page.tbPassword.Text = DecryptString(Properties.PropertyAsString("Token"));
and in the WriteData event, add
Properties.PropertyAsString("Token") = EncryptString(Page.tbPassword.Text);
When you add the Token property to your action, tick the Property is Hidden from Action Inspector and Property is Read Only in Action Inspector options.
To generate your repository string, you'll want to do something like this in the Action's GetCommandLine event:
var repo = Context.Properties.PropertyAsString("Repository");
var username = Context.Properties.PropertyAsString("Username");
var password = DecryptString(Context.Properties.PropertyAsString("Token"));
var repo = "ssh://" + username + ":" + password + "#" + repo;
CommandLine.AddArgument("push", repo, qtNone);
NB, I haven't tested that code, but hopefully it gives you an idea.