Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Could not store password in keychain #5

Closed
xareelee opened this issue Apr 21, 2015 · 12 comments
Closed

Could not store password in keychain #5

xareelee opened this issue Apr 21, 2015 · 12 comments
Labels

Comments

@xareelee
Copy link

I use cert and sigh in fastlane, and it works fine on my computer. But now I want to build the fastlane environment on my server (Mac Mini), it ask the password for the account every time when using cert and sigh.

I try to manually execute the cert and sigh action under Terminal, and it shows the message: security: SecKeychainAddInternetPassword : The specified item already exists in the keychain.
Could not store password in keychain
.

$ sigh
INFO [2015-04-21 15:06:07.62]: Login into iOS Developer Center
No username or password given. You can set environment variables:
DELIVER_USER, DELIVER_PASSWORD
-------------------------------------------------------------------------------------
The login information you enter will be stored in your Mac OS Keychain
More information about that on GitHub: https://github.com/KrauseFx/CredentialsManager
-------------------------------------------------------------------------------------
Password (for XXXX@XXXXXXX.com): ************
security: SecKeychainAddInternetPassword <NULL>: The specified item already exists in the keychain.
Could not store password in keychain
INFO [2015-04-21 15:06:26.49]: Login successful
INFO [2015-04-21 15:06:27.15]: Fetching all available provisioning profiles...
INFO [2015-04-21 15:06:27.90]: Checking if profile is available. (11 profiles found)
INFO [2015-04-21 15:06:31.62]: Downloading profile...
INFO [2015-04-21 15:06:32.41]: Successfully downloaded provisioning profile
....

BTW, the project was pulled from GitHub by Jenkins. The path of the project is /Users/{XXXX}/.jenkins/jobs/iOS develop branch/workspace.

I've tried log in Apple Developer Program and iTunes Connect in a browser and store the keyword in the Keychain. The cert and sigh still ask the password every time.

I can't figure out why this happened.

@KrauseFx
Copy link
Contributor

Try reseting your Keychain maybe? If nothing helps, you could just pass the credentials using the environment variables DELIVER_USER and DELIVER_PASSWORD

@xareelee
Copy link
Author

Reseting my keychain doesn't help. I've tried using environment variables DELIVER_USER and DELIVER_PASSWORD in Fastfile, but the code signing still failed.

⌦  Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “YYYYYYYYYY” were found.



⌦  CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.3'


** ARCHIVE FAILED **


The following build commands failed:
        Check dependencies
(1 failure)
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/actions/actions_helper.rb:56:in `sh'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/actions/ipa.rb:64:in `run'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/fast_file.rb:112:in `block (2 levels) in method_missing'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/actions/actions_helper.rb:35:in `execute_action'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/fast_file.rb:94:in `block in method_missing'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/fast_file.rb:93:in `chdir'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/fast_file.rb:93:in `method_missing'
        from (eval):120:in `block (3 levels) in parse'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/runner.rb:34:in `call'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/runner.rb:34:in `block in execute'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/runner.rb:24:in `chdir'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/runner.rb:24:in `execute'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/lib/fastlane/lane_manager.rb:33:in `cruise_lane'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/bin/fastlane:39:in `block (2 levels) in run'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/commander-4.3.3/lib/commander/command.rb:178:in `call'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/commander-4.3.3/lib/commander/command.rb:178:in `call'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/commander-4.3.3/lib/commander/command.rb:153:in `run'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/commander-4.3.3/lib/commander/runner.rb:428:in `run_active_command'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/commander-4.3.3/lib/commander/runner.rb:68:in `run!'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/commander-4.3.3/lib/commander/delegates.rb:15:in `run!'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/bin/fastlane:118:in `run'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/gems/fastlane-0.12.5/bin/fastlane:124:in `<top (required)>'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/bin/fastlane:23:in `load'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/bin/fastlane:23:in `<main>'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
        from /Users/XXXXXXXX/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

My lane is:

lane :CI_deploy_to_hockey do

  cert

  sigh({
    adhoc: true
  })

  ipa({
    workspace: "YYYYYYY.xcworkspace",
    configuration: "Release",
    scheme: "YYYYYYY",
    clean: true,
  })

  hockey({
    api_token: 'aaaaaaaaaaaaaaaaaaaaaaaaa',
  })

end

The same lane is OK while running on my personal Mac, but failed on Mac mini as the Jenkins server.

@tomaskraina
Copy link

It seems like fasten doesn't have an access to Keychain. Have a look at this: nomad-cli/cupertino#137 and http://superuser.com/questions/270095/when-i-ssh-into-os-x-i-dont-have-my-keychain-when-i-use-terminal-i-do

@xareelee
Copy link
Author

Finally, I find the cause of this problem and solve it.

I'm using Jenkins to run the fastlane, and the Restore OS X keychains after build process as defined in global configuration in Build Environment was checked. After running a Jenkins task, it will automatically hide the Login keychain in the Keychain Access, and I can't access the Apple ID password anymore.

Just simply uncheck the option to solve this problem. Thanks for your help.

@marcpalmer
Copy link

I have this problem too. The error states that the keychain item already exists. And the ssh keychain unlock does not help, that part works.

@marcpalmer
Copy link

FYI if I remove the existing deliver entry from the keychain, it works and saves it, but again next time I run it, it complains that the entry already exists.

It seems like it is failing to read the keychain but is able to write to it if the entry does not exist.

@hammertoe
Copy link

Mark, I get the exact same issue. I've been using DELIVER_USER and DELIVER_PASSWORD env variables for now, but would like to use keychain if possible.

@KrauseFx
Copy link
Contributor

credentials_manager is using the security gem by @mattt which is also used by cupertino.

@k3muri84
Copy link

i have the same issue too, reset my login keychain already.
Would also like that feature.

@dcoufal
Copy link

dcoufal commented Dec 16, 2015

I was also having this problem (i.e. getting:

security: SecKeychainAddInternetPassword <NULL>: The specified item already exists in the keychain. Could not store password in keychain.

and sigh was requesting my password over and over).

After some digging, I found that our password had a backslash "" in it. The security gem apparently does not read those back from the keychain correctly (although it does store them correctly).

After I changed our password to one that did not contain a backslash, we no longer have this issue.

Hope this helps someone.

When I get a little more info, I'll open an issue with the security gem project. I'm assuming this is some kind of escape bug.

@mangofever
Copy link

I have a similar issue.

In my case, it happens when jenkins server has been running more than about a day.
It seems that fastlane cannot read Keychain.
It continuously print out logs on jenkins console. (stty: stdin isn't a terminal)

Solution here is rebooting the jenkins server.
Then it works for a day and not smart at all.

@fastlane-bot-helper
Copy link

This issue was migrated to fastlane/fastlane#1925. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo 🚀

@fastlane-old fastlane-old locked and limited conversation to collaborators Mar 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants