# Difference between pkg REPL and julia -e 'using Pkg; Pkg.\[some command\]'?

**URL:** <https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [March 30, 2025, 5:27pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519 "2025-03-30T17:27:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luc-spec](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luc-spec/32/216072_2.png) [@luc-spec](https://discourse.julialang.org/u/luc-spec)\
**Post date:** [March 30, 2025, 5:27pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519/1 "2025-03-30T17:27:15Z")

</div>

From what I understand, there are a couple of ways to install a package with Julia.

1. the pkg REPL (`julia`, then the `]` key, then `add [SomePkg]`)
2. `julia -e ‘using Pkg; Pkg.add(“[SomePkg]”)’

I’m working with [a custom package](https://github.com/CU-ADCL/DMUStudent.jl) for an academic course, and I’m getting some unexpected behavior.

When I use the REPL method (`pkg> add https://github.com/zsunberg/DMUStudent.jl`), everything works fine.

When I try `julia -e 'using Pkg; Pkg.add(url="https://github.com/zsunberg/DMUStudent.jl"`, the process hangs prompting me for GitHub credentials. It then always fails even if I enter credentials.

Hoping this is a simple fix or maybe something I’m not grasping about the methods I’m using. Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)\
**Post date:** [March 30, 2025, 5:39pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519/2 "2025-03-30T17:39:04Z")

</div>

Hi, and welcome to the Julia community!

The `julia -e` method works for me without any issues on Linux (Julia 1.11.3) (on Windows I need to use `julia -e "using Pkg; Pkg.add(url=\"https://github.com/zsunberg/DMUStudent.jl\")"`). In particular I don’t get prompted for GitHub credentials.

Can you post some more information about your system (e.g. `versioninfo()`)?

---

<div class="post-metadata">

**Author:** ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Post date:** [March 30, 2025, 5:43pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519/3 "2025-03-30T17:43:14Z")

</div>

> [@luc-spec](#):
>
> When I try `julia -e 'using Pkg; Pkg.add(url="https://github.com/zsunberg/DMUStudent.jl"`, the process hangs prompting me for GitHub credentials. It then always fails even if I enter credentials.

It seems like you haven’t closed the parenthesis, try  
`julia -e 'using Pkg; Pkg.add(url="https://github.com/zsunberg/DMUStudent.jl")'`

---

<div class="post-metadata">

**Author:** ![luc-spec](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luc-spec/32/216072_2.png) [@luc-spec](https://discourse.julialang.org/u/luc-spec)\
**Post date:** [March 30, 2025, 5:58pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519/4 "2025-03-30T17:58:45Z")

</div>

Ah, my bad – that was just a typo from the post. The command that fails matches your correction 🙂

---

<div class="post-metadata">

**Author:** ![luc-spec](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luc-spec/32/216072_2.png) [@luc-spec](https://discourse.julialang.org/u/luc-spec)\
**Post date:** [March 30, 2025, 6:07pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519/5 "2025-03-30T18:07:56Z")

</div>

Hello and thank you!

```bash
$ julia --version
julia version 1.11.0-rc3

```

On my host system I use julia-bin from nixpkgs, installed on Fedora 41 via Home-Manager.

I realize that this isn’t a typical installation method, so I will typically use a container instead. The Dockerfile below replicates the error I’m trying to describe.

```Dockerfile
# current container has julia version 1.11.4
FROM docker.io/julia 
RUN julia -e 'import Pkg; Pkg.add(url="https://github.com/zsundberg/DMUStudent.jl")'

```

Short version of the error without the stacktrace:

```bash
$ podman build -t dmu:simple -f simple.Dockerfile [14:03:56]
STEP 1/2: FROM docker.io/julia
STEP 2/2: RUN julia -e 'import Pkg; Pkg.add(url="https://github.com/zsundberg/DMUStudent.jl")'
  Installing known registries into `~/.julia`
       Added `General` registry to ~/.julia/registries
     Cloning git-repo `https://github.com/zsundberg/DMUStudent.jl`
Username for 'https://github.com': ERROR: failed to clone from https://github.com/zsundberg/DMUStudent.jl, error: GitError(Code:EUSER, Class:Callback, Aborting, user cancelled credential request.)

```

---

<div class="post-metadata">

**Author:** ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Post date:** [March 30, 2025, 6:40pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519/6 "2025-03-30T18:40:30Z")

</div>

I also experienced this error a week or two ago, but unfortunately I cannot remember what caused it. This also works fine for me and (like @eldee ) I also do not get prompted for Github credentials.

Do you have a startup.jl file? Have you set up any relevant environment variables? Are there any other packages in your `Project.toml`?

I noticed

> [@luc-spec](#):
>
> ```bash
> Installing known registries into `~/.julia`
> Added `General` registry to ~/.julia/registries
> 
> ```

this might have been the problem when I saw this error a few weeks ago.

---

<div class="post-metadata">

**Author:** ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Post date:** [March 30, 2025, 7:22pm UTC](https://discourse.julialang.org/t/difference-between-pkg-repl-and-julia-e-using-pkg-pkg-some-command/127519/7 "2025-03-30T19:22:11Z")

</div>

A suggestion to get something that absolutely should work is to delete or rename your ~/.julia directory and then execute:

```bash
julia -e 'import Pkg; Pkg.add("Example")'

```

If this does not work, try installing julia with `juliaup` and repeat the above steps.

If it does work, try something closer to your original post and find out what exactly triggers the problem.
