Trouble publishing my first package to GitHub

I’m trying to create a package like this:

using PkgTemplates 
t = Template(;user="chadagreene", plugins = [GitHubActions(), Codecov()])

After running the lines above, in GitHub Desktop, I select Add Existing Repository:

Screenshot 2023-01-20 at 6.26.53 PM

I select the Foo folder, and all seems well, but when I try to publish this branch I get an error message that says “The repository does not seem to exist anymore. You may not have access, or it may have been deleted or renamed.

What are the proper steps for creating a repo and linking it to GitHub? Unfortunately the PkgTemplates documentation doesn’t provide any simple examples–it just skips to “A more complicated example”, which is presented without context or explanations.

I don’t know how to use GitHub Desktop, but if you use the GitHub webpage to create an empty repository, it will show you directions on how to connect your local repository to the empty GitHub repository. The directions look like this:

Hmm…this is weird… Now I am attempting to make a Foo repo first, then I use PkgTemplates, but it creates a second folder named Foo. How is it even possible to have two folders by the same name, in the same directory?

Screenshot 2023-01-21 at 10.31.18 AM

This step by step has worked for me: Create new package · JuliaNotes.jl

Thanks @lmiq. The JuliaNotes page helped me get on the right path, and then I had to figure out a few things on my own. I also found this excellent tutorial for developing new packages, but unfortunately that page appears to be outdated and might lead to errors. Here are the steps that worked for me:

1. Make a new repo via the GitHub web interface.

Log in to GitHub, click the Repositories tab, and then click New.

Name the repository something ending in .jl, without spaces or special characters. If multiple words are in the package name, capitalize the first letter of each word (e.g., MyPackage.jl). Here, my package is named Foo, so I’ve named the repository Foo.jl:

On the same page, I set my repo to Private and clicked Create repository:

2. Initialize the package in Julia using PkgTemplates

Launch VS Code, press Ctrl+shift+p and click “Julia: Start REPL”. Then, in the REPL, add the PkgTemplates package if you haven’t already, and type:

using PkgTemplates 
t = Template(;user="chadagreene", plugins = [GitHubActions(), Codecov()])

Above, I entered my GitHub username, and I also specified the local directory where I want my package to exist on my computer. Specifying the local directory is important for me, as a beginner, because by default, the package management system puts everything in a hidden folder. If you want to see, explore, and easily interact with the files in your new package, specify the filepath to your preferred location as I’ve done above.

And of course, make sure the file path ends in the same name as the repo you just created on GitHub (above, you see that the path ends in Foo.jl).

The three lines of code above create a folder called Foo.jl on your local machine. Again, if you don’t specify a directory, it will end up in a hidden folder called ~/.julia/dev/Foo, but I’ve placed mine in my /Users/cgreene/Documents/GitHub/Foo folder.

Note: there’s some inconsistency in how PkgTemplates names the folder it creates. Although you need to specify the package name ending in .jl when using PkgTemplates, and you must also end the GitHub repo name with .jl, the folder that PkgTemplates creates will just be Foo, without the .jl.

3. Publish the new package via GitHub Desktop

Launch GitHub Desktop, click Add and Add Existing Repository, like this:

Now, specify the same directory that we entered into the Julia REPL, and click Add Repository:

Click Publish branch:

Screenshot 2023-01-22 at 5.51.04 PM

4. Check online to confirm existence of new repo:

Now if you refresh your Repositories tab online, you should see that the new package template has made it into your online repo: