简体   繁体   English

无法从Xcode访问Mac服务器

[英]Can't access Mac server from Xcode

I wanted to create a remote repository in my Mac server. 我想在Mac服务器上创建一个远程存储库。 I have installed the app, configured and started the Xcode service as per the Apple docs. 我已经按照Apple文档安装了该应用程序,配置并启动了Xcode服务。 But when I try to add the server to my accounts in Xcode, the server name is there, but on adding, it is giving the following error. 但是,当我尝试将服务器添加到使用Xcode的帐户中时,服务器名称在那里,但是添加时却出现以下错误。

Unable to perform the request. 无法执行请求。 CFNetwork error: The network connection was lost. CFNetwork错误:网络连接丢失。 (-1005 - kCFURLErrorNetworkConnectionLost) (-1005-kCFURLErrorNetworkConnectionLost)

The server is hosted on the same Mac in which I am developing. 该服务器托管在我正在开发的同一台Mac上。

I've run into the same issue (my server is on the LAN but it had previously been working). 我遇到了同样的问题(我的服务器在局域网上,但是以前一直在工作)。

I'm assuming you've got a Git repository created locally and you want to push it to the server. 我假设您已经在本地创建了一个Git存储库,并且希望将其推送到服务器。 I'm using Xcode 8.2 我正在使用Xcode 8.2

The only 'solution' I've found so far is to manually create the remote from the Mac Server app (you could also do it on the command line if you want). 到目前为止,我发现的唯一“解决方案”是从Mac Server应用程序手动创建遥控器(如果需要,也可以在命令行上进行操作)。 The steps I used: 我使用的步骤:

  1. Go to the Xcode section of the Server app, select 'Repositories' on that screen, then the + button to add a repository with the name you specified. 转到“服务器”应用的Xcode部分,在该屏幕上选择“存储库”,然后使用+按钮添加具有您指定名称的存储库。
  2. After doing that; 之后, go back to Xcode proper and with your project selected Open the 'Source Control' menu, select your repository then click 'Configure ' 返回到正确的Xcode并选择您的项目打开“源代码控制”菜单,选择您的存储库,然后单击“配置”
  3. In the resulting dialog, select the 'Remotes' tab 在出现的对话框中,选择“远程”选项卡
  4. Click the '+' button and select 'Add remote...' 点击“ +”按钮,然后选择“添加远程...”
  5. Another dialog comes up. 出现另一个对话框。 For 'Name' use the same name as you did in the Server. 对于“名称”,请使用与服务器中相同的名称。 Address should be whatever Server->Xcode reports for the repository you created (something like ssh://hostname/git/MyRepositry.git). 地址应该是您为存储库创建的Server-> Xcode报告的任何内容(例如ssh://hostname/git/MyRepositry.git之类)。
  6. Click 'Add Remote' 点击“添加远程”
  7. Click 'Done' 点击“完成”
  8. You should now be able to push/pull between your local and remote repository. 现在,您应该能够在本地和远程存储库之间进行推/拉。

Not the best solution, but as I say, it's the only one I've found so far. 这不是最佳解决方案,但正如我所说,这是我到目前为止发现的唯一解决方案。 Quite a few people seem to be asking this, but none of them seem to have found better answers either. 似乎有很多人在问这个问题,但他们似乎都没有找到更好的答案。 To find some of the other people reporting the problem, I used the following search term in google: 为了找到其他报告问题的人,我在Google中使用了以下搜索词:

git unable to perform the request cfnetwork error the network connection was lost xcode 

Just do the following steps : 只需执行以下步骤:

1.Remove your Server from Xcode 1.从Xcode删除服务器
2.Quit Xcode 2.退出Xcode
3.Restart/Shutdown machine (If I don't restart/shutdown machine, unable to add server again in my case) 3.重新启动/关闭计算机(如果我不重新启动/关闭计算机,则无法重新添加服务器)
4.Open Xcode 4,打开Xcode
5.Add Server again 5,再次添加服务器

This Solution works for me, but its not proper solution. 此解决方案对我有用,但不是正确的解决方案。 It's headache to repeat the above steps every time while facing same issue, I research more on this but did not get any proper satisfactory solution. 面对相同的问题时,每次重复上述步骤都是令人头疼的事,我对此进行了更多研究,但未获得任何适当的满意解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM