This is an old revision of the document!
Git Quick Start Guide
This page is to capture issues raised on IRC by other committers and users, so we don't lose that info while it gets added to official documentation. The steps here should mirror the more detailed instructions at the below url:
- https://docs.freebsd.org/en/articles/committers-guide/#git-primer
Quick Start
Pick an empty directory, let's call it ~/src/ports for example. A full clone takes about 900MiB space.
# pick any GIT_PORTS_DIR you want export GIT_PORTS_DIR=~/src/ports # this step can take a while, in future it will be much quicker git clone -o freebsd -b main https://git.freebsd.org/ports.git $GIT_PORTS_DIR cd $GIT_PORTS_DIR # now we add in your push URL, and fetching the old SVN notes so you can # look for svn revisions in your git log git remote set-url --push freebsd ssh://git@gitrepo.freebsd.org/ports.git git config --add remote.freebsd.fetch "+refs/notes/*:refs/notes/*" # now we enable "rebasing" which will float your latest commits to the top # of the git tree, each time you pull new commits from the ports tree. This # makes it very easy to catch up if somebody else committed in between your # last fetch, and your attempted push. git config pull.rebase true
You'll now need to add your username and user id, exactly as they are on freefall:
ssh you@freefall gen-gitconfig.sh ... git config user.name "A Committer" git config user.email "you@FreeBSD.org" ...
After these steps, you should have this in your $GIT_PORTS_DIR/.git/config :
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "freebsd"]
url = https://git.freebsd.org/ports.git
fetch = +refs/heads/main:refs/remotes/freebsd/main
fetch = +refs/notes/*:refs/notes/*
pushurl = ssh://git@gitrepo.freebsd.org/ports.git
[branch "main"]
remote = freebsd
merge = refs/heads/main
[pull]
rebase=true
[user]
# these entries came from ssh you@freefall gen-gitconfig.sh
name = A Committer
email = you@FreeBSD.org
Common Problems
ssh issues
$ git push git@gitrepo.freebsd.org: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
This means that our git server is not accepting your public key. This should be the same one used for your access to freefall. You can check this easily:
$ ssh git@gitrepo.freebsd.org PTY allocation request failed on channel 1 hello $YOU, this is git@gitrepo running gitolite3 v3.6.12 on git 2.30.1 R W doc R W ports R W src Connection to gitrepo.freebsd.org closed.
You can debug further using GIT_SSH_COMMAND="ssh -v" git ...:
env GIT_SSH_COMMAND="ssh -v" git push OpenSSH_8.4p1, OpenSSL 1.1.1k-freebsd 25 Mar 2021 debug1: Reading configuration data .ssh/config debug1: .ssh/config line 1: Applying options for * debug1: .ssh/config line 17: Applying options for *.freebsd.org debug1: Reading configuration data /usr/local/etc/ssh/ssh_config debug1: auto-mux: Trying existing master debug1: Control socket "/tmp/.ssh-master-git@gitrepo.freebsd.org:22" does not exist debug1: Connecting to gitrepo.freebsd.org [96.47.72.44] port 22. debug1: Connection established. ... debug1: No more authentication methods to try. git@gitrepo.freebsd.org: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.