Cannot access repositories on OS X Server 3.2.1 wi

2020-05-06 11:20发布

EDIT:
The problem is apparently solved with OSX Server Version 4.

Original post:
I have some git repositories on OS X server. Earlier I could access them from a remote Xcode without problems.
After the upgrade to OS X Server 3.2.1 with Xcode 6.0.1, I can no longer access them:

If I try to add the server to a the Xcode via Preferences / Accounts, it says

Xcode Server is unavailable 

If I try it via the terminal with the command

git clone <repository path>

it is asking for the password (i.e. it can access the server), and then says

fatal: repository '<repository path>' not found  

It is really annoying since everything worked fine before. Any help how I could fix this?

EDIT 1:

Of course, the new OS X server shows the repositories under Xcode / Repositories, so they are still there...

EDIT 2:

I just realized that sometimes (very rarely) a local Xcode as well as a remote Xcode find the repositories and can access them either immediately, or after asking for the password. Very frustrating!

EDIT (due to the answer of Dan Hansen):

I tried to use SSH, but failed:

  • On the remote OS X server, I enabled SSH access to the repositories.
  • On my Mac under Xcode, I added the remote repository using SSH protocol. This worked fine.
  • I then tried a pull under Xcode, and was asked for the password. After entering the correct password, it claimed that it were wrong.
  • Further accesses from Xcode always gave „no remotes“.
  • I switched to terminal, and issued a „git clone“ command. I was asked 3 times for the password, and got then the error „Permission denied (publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive)“

So it seems to me like an authorization problem, but I don’t know how to approach it.

2条回答
来,给爷笑一个
2楼-- · 2020-05-06 11:58

Maybe this will help. Seems like xCode bug for me. Instead of trying to add an repository in xCode preferences in accounts tab i did next steps (some might be unnecessary):

1) Goto xCode Preferences -> Accounts and delete bugged repository if it present (it seems like even if you chose username xCode deleting it)

2) Goto Keychain Access and delete key for your repository if it present

3) Goto Source Control -> "Your_Project_Name - Your_Branch_Name" -> Configure Your_Project_Name -> Remotes. Check if there is your remote and IF NO add it, you'll only need url without login and password. Then go to tab Branches and xCode will try to receive remote branches and will ask for your login and password. After i entered it, repository was added properly to my accounts and i can use it for pushes.

查看更多
太酷不给撩
3楼-- · 2020-05-06 12:08

I encountered this same problem after the upgrade and worked out a fix that works for me. Perhaps it will help you as well.

I have an HTTPS GIT repository running under the Xcode service in the Server app. I use it for syncing projects that are on the local macbook pro (the Server), a VM (virtual machine) running Win 8.1 and a remote VM running on another macbook pro (also Win 8.1).

On the two macbook pro's I use Xcode to interact with the GIT repo. I use "GIT bash" command line to interact with the Win 8.1 repo(s). Works great.

The upgrade to OS X Server 3.2.1 with Xcode 6.0.1 broke my repositories. First I encountered certificate issues - once I worked through those I started getting the "fatal: repository ... not found" errors you are seeing.

I researched the issue and started digging into the logs and new Service. I suspect the underlying problem may be something like a bad symlink (there were complaints in the log about ScriptAliases for /git being wrong) but the more I dug into the new directory structure the more I saw it was a bit of a convoluted beast, and I did not really want to just start messing around with the symlinks, etc. Seemed like a formula for disaster.

The fix for me was to switch to using SSH for referencing the repo (rather than HTTPS).

So on the remote VM I did the following:

git remote rm origin

git remote add origin ssh://dhansen@my-server-address/git/my-repo.git

git push -u origin master

Of course, I had to make sure that I had "remote login" turned on in "Sharing" and had ssh set up properly, but otherwise it worked like a charm.

On the other remote VM, I had to do much the same thing. I did encounter a wrinkle when trying to push from one of the remote Win 8.1 VM to the second Xcode service repo, when it had an error "remote:error: insufficient permission for adding an object to the repository database ./objects. remote: fatal: failed to write object"

I had to:

cd /Library/Developer/XcodeServer/HostedRepositories

and change the permissions. Looked like somethings were now root:_xcs and some were owned by root:_www.

That fixed the last issue. And now it all works like a charm again, I am much relieved, though annoyed I had to spend so much time troubleshooting it.

It is a complete annoyance that a normal upgrade broke perfectly fine HTTPS connections to the repositories, but luckily for me it looks like you can work around it using SSH.

Good luck!

查看更多
登录 后发表回答