Adding Swift packages into project with Xcode 13

I'm not able to add Swift packages into the project anymore with Xcode 13. I tried to add Alamofire by searching its URL but I always got the error bellow.

I tried to add my GitHub account into Xcode too but the result is similar.

Answered by Deny in 692697022

I figured out what was the issue was. Xcode can't read the .gitconfig file properly. In my case I have these lines in my global .gitconfig file:

[includeIf "gitdir:~/Developer/"]
    path = ~/.gitconfig_per

[includeIf "gitdir:~/Developer/Cleverlance/"]
    path = ~/.gitconfig_clv

This setup allows to associate specific Git configs with location of a repository in the file system. So when all my main job project are located in ~/Developer/Cleverlance/ directory, the content of the ~/.gitconfig_clv appends to the global .gitconfig file.

The content of the partial config is bellow:

[user]
        name = Deny Green
        email = deny.green@cleverlance.com
        signingkey = *********************************

I think that Xcode should should be able to read these settings properly and respect them.

Accepted Answer

I figured out what was the issue was. Xcode can't read the .gitconfig file properly. In my case I have these lines in my global .gitconfig file:

[includeIf "gitdir:~/Developer/"]
    path = ~/.gitconfig_per

[includeIf "gitdir:~/Developer/Cleverlance/"]
    path = ~/.gitconfig_clv

This setup allows to associate specific Git configs with location of a repository in the file system. So when all my main job project are located in ~/Developer/Cleverlance/ directory, the content of the ~/.gitconfig_clv appends to the global .gitconfig file.

The content of the partial config is bellow:

[user]
        name = Deny Green
        email = deny.green@cleverlance.com
        signingkey = *********************************

I think that Xcode should should be able to read these settings properly and respect them.

This is issue is very old (I initially faced it on Xcode 11) and I wonder why Apple has not fixed it yet. There are many times that you are working for multiple companies or for customers of your company that have their own workspaces set up and provide different email addresses to software engineers. Every time I need to add a Swift Package dependency I have to rename my ~/.gitconfig and then remember to name it back with the proper name in order for this to work.

Running into this issue as well, I really hope this gets fixed soon. Like @iannis above, I have to frequently change my .gitconfig every time I want to do something with Swift Packages. It gets old quick. It's amazing to me how far behind Xcode is when it comes to supporting some pretty standard things.

Adding Swift packages into project with Xcode 13
 
 
Q