# Trouble publishing my first package to GitHub

**URL:** https://discourse.julialang.org/t/trouble-publishing-my-first-package-to-github/93293
**Category:** New to Julia
**Tags:** package, github
**Created:** [January 21, 2023, 2:40am UTC](https://discourse.julialang.org/t/trouble-publishing-my-first-package-to-github/93293 "2023-01-21T02:40:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)
#### Post date: [January 21, 2023, 2:40am UTC](https://discourse.julialang.org/t/trouble-publishing-my-first-package-to-github/93293/1 "2023-01-21T02:40:45Z")

</div>

I’m trying to create a package like this:

```julia
using PkgTemplates 
t = Template(;user="chadagreene", plugins = [GitHubActions(), Codecov()])
t("/Users/cgreene/Documents/GitHub/Foo.jl")

```

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

![Screenshot 2023-01-20 at 6.26.53 PM](https://global.discourse-cdn.com/julialang/original/3X/1/2/123ffb3be8f92d3746714bab63b29e45d14cb43e.png)

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.** ”

 ![Screenshot 2023-01-20 at 6.28.57 PM](https://global.discourse-cdn.com/julialang/original/3X/1/f/1fd53a7ab3f63f34b55b8461037056c06c7add4d.png)

What are the proper steps for creating a repo and linking it to GitHub? Unfortunately the [PkgTemplates documentation](https://juliaci.github.io/PkgTemplates.jl/stable/user/) doesn’t provide any simple examples–it just skips to “A more complicated example”, which is presented without context or explanations.

---

<div class="post-metadata">

### Author: ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)
#### Post date: [January 21, 2023, 3:41am UTC](https://discourse.julialang.org/t/trouble-publishing-my-first-package-to-github/93293/2 "2023-01-21T03:41:01Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/9/195719d466eb1ccf1d6aa77ab9fb4b3e2b3f5b3c.png)

---

<div class="post-metadata">

### Author: ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)
#### Post date: [January 21, 2023, 6:36pm UTC](https://discourse.julialang.org/t/trouble-publishing-my-first-package-to-github/93293/3 "2023-01-21T18:36:18Z")

</div>

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](https://global.discourse-cdn.com/julialang/original/3X/e/b/ebee074ad23ca6e50a01c15a593ad7cdc2d96272.png)

---

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [January 21, 2023, 6:41pm UTC](https://discourse.julialang.org/t/trouble-publishing-my-first-package-to-github/93293/4 "2023-01-21T18:41:51Z")

</div>

This step by step has worked for me: [Create new package · JuliaNotes.jl](https://m3g.github.io/JuliaNotes.jl/stable/new_package/)

---

<div class="post-metadata">

### Author: ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)
#### Post date: [January 23, 2023, 1:53am UTC](https://discourse.julialang.org/t/trouble-publishing-my-first-package-to-github/93293/5 "2023-01-23T01:53:32Z")

</div>

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](https://medium.com/coffee-in-a-klein-bottle/developing-your-julia-package-682c1d309507), 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**.

 ![Screenshot 2023-01-22 at 5.44.23 PM](https://global.discourse-cdn.com/julialang/original/3X/4/a/4a6a8bf06d8709f7af23925921ddbbf05a04d0a7.png)

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:

 ![Screenshot 2023-01-22 at 5.45.31 PM](https://global.discourse-cdn.com/julialang/original/3X/a/5/a53c108852c87fec34bbb86a6816ac21923e6e66.png)

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

 ![Screenshot 2023-01-22 at 5.46.21 PM](https://global.discourse-cdn.com/julialang/original/3X/b/2/b26ea650e56e2ca456c7519c883d992ada42fb32.png)

# 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:

```julia
using PkgTemplates 
t = Template(;user="chadagreene", plugins = [GitHubActions(), Codecov()])
t("/Users/cgreene/Documents/GitHub/Foo.jl")

```

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:

 ![Screenshot 2023-01-22 at 5.49.47 PM](https://global.discourse-cdn.com/julialang/original/3X/2/3/23a56ad3e4f0bc141201d0c6b3d3bf0b3f9d92e3.png)

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

 ![Screenshot 2023-01-22 at 5.50.48 PM](https://global.discourse-cdn.com/julialang/original/3X/2/4/2426a69c9796d35afba0dfd15ca3ae251c8052cd.png)

Click **Publish branch** :

 ![Screenshot 2023-01-22 at 5.51.04 PM](https://global.discourse-cdn.com/julialang/original/3X/2/5/253eb8c75fe792cd737d73d8fea0578d46e03fe9.png)

# 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:

 ![Screenshot 2023-01-22 at 5.51.36 PM](https://global.discourse-cdn.com/julialang/original/3X/1/e/1e3d0bdf1f5deab7c1c811e4c44572ba41c2ef03.png)
