Xcode 12 SPM does not fetch packages - xcode

I've been seriously frustrated with SPM, I am simply unable to fetch packages. Would really appreciate any suggestions you may have.
When I open Xcode project my laptop is unable to resolve SPM packages that does work on another computer.
I get the following error message for every package:
Missing package product 'Alamofire'
If I remove the package and try to add it manually via
File > Add Package dependency
Put URL: https://github.com/Alamofire/Alamofire.git
It then asks me sign in with Github account (even I have already added Github Account to Xcode and this is public repository).
After logging in it asks me to input version and upon clicking Next says "The repository could not be found. Make sure a valid repository exists at the specified location and try again."

The problem was with clearing ~/.ssh/config. I had removed line which forced ssh connection.

Related

Problem installing forked github repository to R

I am currently working on a research that requires me to add some model functions into the gstat package in R. I forked it from the author on github, added the functions that i needed to experiment on, and rename it in my github repository. But i cant install it into R.
> install_github("JohannahKiram/gstatmod")
Error: Failed to install 'unknown package' from GitHub:
HTTP error 404.
No commit found for the ref master
Did you spell the repo owner (`JohannahKiram`) and repo name (`gstatmod`) correctly?
- If spelling is correct, check that you have the required permissions to access the repo
what am i doing wrong? I dont want to push it to the author cause i just need to experiment the changes first.

dotnet add package with source giving an unauthorize error 401 and 404 Not found

we are updating the nuget packages in dotnet application with dotnet add package "package name" from a private feed in Azure Devops.
Recently we updated to .net 5.0.1( I am not sure if its related to the issue.)
But now while running the above command gives error in local machine as well as in azure piplelines.
I have tried the --interactive option and refreshed the PAT for packages etc as well.
command dotnet add "csprojFile" package "mypackageName"
Determining projects to restore...
Writing C:\Users\SirajUrRahman\AppData\Local\Temp\tmpD8BD.tmp
info : Adding PackageReference for package 'my package' into project '.\my csproj'.
info : GET https://api.nuget.org/v3/registration5-gz-semver2/mypackageName/index.json
info : NotFound https://api.nuget.org/v3/registration5-gz-semver2/mypackageName/index.json 889ms
error: Unable to load the service index for source https://pkgs.dev.azure.com/myorganization/_packaging/Feed/nuget/v3/index.json.
error: Response status code does not indicate success: 401 (Unauthorized).
Usage: NuGet.CommandLine.XPlat.dll package add [options]
Options:
-h|--help Show help information
--force-english-output Forces the application to run using an invariant, English-based culture.
--package Id of the package to be added.
--version Version of the package to be added.
-d|--dg-file Path to the dependency graph file to be used to restore preview and compatibility check.
-p|--project Path to the project file.
-f|--framework Frameworks for which the package reference should be added.
-n|--no-restore Do not perform restore preview and compatibility check. The added package reference will be unconditional.
-s|--source Specifies NuGet package sources to use during the restore.
--package-directory Directory to restore packages in.
--interactive Allow the command to block and require manual action for operations like authentication.
--prerelease Allows prerelease packages to be installed.
Thanks for any help.
Feel free to ask anything if needed.
This issue was related to .net 5 and there is already a bug created for that on github here is the link for that. https://github.com/NuGet/Home/issues/10305.

Artifactory composer packages.json 404

I am using artifactory and have no issues with the npm solution. However, I have set up composer using the "Set Me Up" instructions, i.e. installed the ~/.composer/config.json & ~/.composer/auth.json files. I now get the following error when I try to perform a composer install:
$ dcomp install
Loading composer repositories with package information
[Composer\Downloader\TransportException]
The "https://myartifactory.jfrog.io/artifactory/api/composer/php-local/packages.json" file could not be downloaded (HTTP/1.1 404 Not Found)
install [--prefer-source] [--prefer-dist] ...
The user I have configured in auth.json is an admin user, and I've pushed a single package into the Artifactory. Additionally, I noticed the url contains plural packages.json as opposed to singular package.json, so I am assuming this is an issue with the artifactory configuration itself and not the package I've uploaded.
For Artifactory to index composer packages successfully you also need to make sure that each package has version specified.
There are 3 ways to achieve that:
Include the version attribute in the package composer.json file
Set a composer.version property on the package itself.
Use the version field when deploying it via the UI.
You can easily test it inside the UI by clicking on the archive you just uploaded, then go to the properties tab and add a property for example:
composer.version with value for example 1.0.0.
The issue in my case was as a couple commenters observed: the index wasn't being generated.
For me, the fix was a matter of using a .zip compressed file to upload composer packages instead of a .tar.gz. I can't tell you why a tarball won't work, especially considering Artifactory's documentation explicitly mentions tar.gz, but it would appear .zip is the way to go.
When you first create a PHP composer repository in Artifactory it will not have the repository index yet (package.json file). The index will be created only after you deploy your first package.
It is possible that Artifactory was unable to read the package metadata for the package you deployed. In such a case, assuming this is the only package in the repository, the index will not be calculated.
In order to verify this is the case:
Browse the php-local repository in the Artifactory UI
Check for the presence of a .composer/packages.json file (relative to the repository root). If it does not exist, it is an indication that Artifactory was unable to calculate the repository index
Select the package you deployed, and switch to the Composer Info tab
Check that you can see the correct package version. If you see "No version found" - there was an issue with getting the version (probably because it is not included in the composer.json file)
Look for an error similar to the following in the artifactory log file:
Failed to persist package metadata for 'php-local/my-package.zip'.
Unable to read the package version from the extracted composer.json
file
If this is the case, you can solve the issue by:
Add a property named composer.version to your composer package and set its value to be the correct package version. You can do it by selecting the package file from the UI, switching to the Properties tab and adding a new property
If this done correctly you should be able to see the correct version in the Composer Info tab and that the packages.json file is being generated
If all of this does not help and the packages.json file is still not generated, there is probably another error which prevents Artifactory from generating it.
Try re-generating the repository index by:
Going to the root of the repository in the Artifactory UI
Right click the root of the repository and choose "Recalculate Index"
The index should be generated in the background
If the index is still not generated search the artifactory log file for any relevant error messages
Finally, one more option to try is deploying a different composer package and seeing if it behaves the same.
I have seen an Include / Exclude Pattern on the Jfrog repository that does not match the <vendor>/<package> naming standard cause this issue. We were able to upload artifacts but they were excluded metadata endpoint.
The following endpoint returned a 404 response code for every package until the Include / Exclude Pattern was fixed.
https://<org>.jfrog.io/artifactory/api/composer/<repo>/p2/<vendor>/<package>.json

GitHub error "Failed to get HEAD"

I'm new to GitHub and mainly going to be using it to backup service and to show off code. Anyhow, I'm trying to get my latest program up there and am getting the error in the title of this thread when I try to push.
Repro steps:
Sit in Starbucks with crappy wifi (Could this be related to the problem? Serious question.)
Open latest version of GitHub for latest Macintosh operating system
File --> New Repository
Local Path --> the folder that contains my XCode project
Name --> give it a name
Publish
Sync
Push .... Get error
Look in my XCode project's folder and it looks like an empty subfolder with the name of my GitHub project was created there. Huh?
I had these issues, I followed these steps to resolve.
cd /directory
git init
git add .
git commit -m "Name of Repo"
I then opened the github desktop application and dragged the folder over.
All my files are now available and I can make commits. Hope this helps.
I received a similar error using GitHub Desktop on OS X. I got the error when trying to commit files for the first time to a newly created repository. The error message was something along the following: Failed To Get Head (Unborn)
The steps I followed to create the error were:
Created a new repository on GitHub.com
Cloned the empty repository using GitHub Desktop
Created a new project locally on my computer inside the directory I cloned the repository to in step 2.
Using GitHub Desktop, tried to commit the files. This is when I got the error.
To "fix" this, I went to GitHub desktop and created a ReadMe for the repository. I then 'Synced' the repository on GitHub Desktop and was able to commit.
This error can appear if you did not initiate the repository. make sure to check the box saying "Initialize this repository with a README"
In my case all I needed to do was to run:
git add -A
After this I was successfully able to commit through the GitHub client.
I was using Xcode and I copied some files into the folder with my project and they were not automatically added to the git (hence the error).
git reset
And then come back to GitHub Desktop. That works in my case.
Certainly not the Starbucks Wifi.
This happened to me with the official GitHub client when I tried to make an initial commit, I then tried again using the inbuilt versioning module within my code editor (Intellij IDEA) and it worked just fine.
I won't even hazard a guess to the cause of the problem, but try a different GIT client if you need a potential quick fix.
Please try to commit first and try to push. I am also very new to git, I used to SVN a lot, It worked for me after initial commit.

xcode, error when commiting to github repository

I am developing an iphone project on xcode and I'd like to commit my code to a git repository on github. When I select the "commit" option within xcode I got the following error message:
The working copy "iphone" could not be reached.
Please verify that the working copy is reachable and try again.
I checked in the repository option and deleted the repository I had set up at the beginning. My code is under git and I have added the remote origin but still... it does not work from xcode (I have to commit and push from command line which is working fine).
Any idea ?
Make sure this isn't about some locked resource which prevents XCode to access your local repo.
For instance, in "Can't add xCode 4.2 project to repository (and get it working)", a reboot actually helped...

Resources