# git pull of /usr/src fails



## JMOR (Sep 28, 2021)

Hello,

I am trying to update the /usr/src repository and I am getting this error:

```
# git -C /usr/src pull
error: cannot lock ref 'refs/remotes/freebsd/vendor/openzfs/legacy': 'refs/remotes/freebsd/vendor/openzfs' exists; cannot create 'refs/remotes/freebsd/vendor/openzfs/legacy'
From https://git.FreeBSD.org/src
 ! [new branch]              vendor/openzfs/legacy          -> freebsd/vendor/openzfs/legacy  (unable to update local ref)
error: cannot lock ref 'refs/remotes/freebsd/vendor/openzfs/master': 'refs/remotes/freebsd/vendor/openzfs' exists; cannot create 'refs/remotes/freebsd/vendor/openzfs/master'
 ! [new branch]              vendor/openzfs/master          -> freebsd/vendor/openzfs/master  (unable to update local ref)
error: cannot lock ref 'refs/remotes/freebsd/vendor/openzfs/zfs-2.1-release': 'refs/remotes/freebsd/vendor/openzfs' exists; cannot create 'refs/remotes/freebsd/vendor/openzfs/zfs-2.1-release'
 ! [new branch]              vendor/openzfs/zfs-2.1-release -> freebsd/vendor/openzfs/zfs-2.1-release  (unable to update local ref)
```
This is `uname -a`:

```
# uname -a
FreeBSD joseland.home 13.0-STABLE FreeBSD 13.0-STABLE #40 stable/13-n245691-024a9aa7010: Tue Sep 14 12:48:13 CEST 2021     root@joseland.home:/usr/obj/usr/src/amd64.amd64/sys/MYKERNEL  amd64
```
It seems something silly, but any idea how to fix it?

Thanks in advance.


----------



## SirDice (Sep 28, 2021)

Try a `git pull -p`.


----------



## JMOR (Sep 28, 2021)

Thank you SirDice.

`git -C /usr/src pull -p` did the trick.


----------



## SirDice (Sep 28, 2021)

The reason you need to add the `-p` option is because a few branches were removed, and a normal `git pull` would try to update those. It will fail because those branches don't exist anymore. Adding the `-p` option "prunes" those deleted branches.


----------

