Solved Git pull not pulling in updates!

Discussion: I set up a manually-managed 'Remote' git repo at https://git.beastie.localdomain/freebsd_kde/.git . Corresponding localhost directory is: /usr/local/poudriere/ports/freebsd_kde/ I can use that HTTP URL to clone it:
Code:
# pwd
/home/astyle
# git clone https://git.beastie.localdomain/freebsd_kde/.git
Cloning into 'freebsd_kde'...
Fetching objects: 174878, done.
Updating files: 100% (139130/139130), done.
 # git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
# git log
commit a37e678470dc59de1d4a9fb0e5e6db2ca066ee9a (HEAD -> master, origin/master, origin/HEAD)
Author: Charlie Root <root@beastie.localdomain>
Date:   Sat Jan 8 19:33:39 2022 -0800

    First commit. Frameworks 5.82, Plasma 5.21
#
# git clone clearly did not pick up anything after the first commit! My 'Remote' repo is below.
Code:
# pwd
/usr/local/poudriere/ports/freebsd_kde
 # git status
On branch master
nothing to commit, working tree clean
 # git log
commit 9cdfec9f973fbe4442bf697d920cc889c9933e55 (HEAD -> master)
Author: Charlie Root <root@beastie.localdomain>
Date:   Sat Jan 15 20:11:55 2022 -0800

    Second commit. Frameworks 5.82 -> 5.83, Plasma 5.21.5 -> 5.22.5

commit 27649bf72e6bad6d25c0a5d572a47b6b9226e8e8
Author: Charlie Root <root@beastie.localdomain>
Date:   Wed Jan 12 19:12:22 2022 -0800

    Commit 2, multimedia/svt-hevc

commit a37e678470dc59de1d4a9fb0e5e6db2ca066ee9a
Author: Charlie Root <root@beastie.localdomain>
Date:   Sat Jan 8 19:33:39 2022 -0800

    First commit. Frameworks 5.82, Plasma 5.21
#

Below is how the second commit came about:
Code:
# pwd
/usr/local/poudriere/ports/freebsd_kde
# portsnap extract -p /usr/local/poudriere/ports/freebsd_kde/ multimedia/svt-hevc/
(Feedback I'm not gonna reproduce here, command completed successfully)
# git add ./\*
# git commit -m 'Commit 2, multimedia/svt-hevc'
# git status
On branch master
nothing to commit, working tree clean

So why can't I see that second commit when I clone?

When it comes to git, I'm a total newbie. I tried looking on StackOveflow for help, but without much success. Maybe I'm not formulating my Google queries well, or maybe I'm not making sense of the info I'm seeing out there.
 
Try using to use - a for the commit. It's hard to tell for sure due to lack of details. Also, why are you doing this as root? That could turn into an issue of its own.
 
Well, first of all, the .git subdirectory conains git metadata, but it's not "the repository". I wonder why accessing it as such does anything at all. The repository, in your case, would just be /usr/local/poudriere/ports/freebsd_kde.

But before I explain more, could you please explain what you're trying to achieve (without mentioning git if possible)? It looks to me like you're trying to also "push" changes there where poudriere would build them? If so, this won't work :-/
 
Not sure if I understood the issue, it seems a git push is missing.
This is a typical workflow, see if it helps:
GIT Data Transport Commands.png
 
Well, first of all, the .git subdirectory conains git metadata, but it's not "the repository". I wonder why accessing it as such does anything at all. The repository, in your case, would just be /usr/local/poudriere/ports/freebsd_kde.

But before I explain more, could you please explain what you're trying to achieve (without mentioning git if possible)? It looks to me like you're trying to also "push" changes there where poudriere would build them? If so, this won't work :-/
Well, I tried several ways to pull in the repo via the git command:
  • file:///usr/local/poudriere/ports/freebsd_kde gave me the error: GIT_DISCOVERY_ACROSS_FILESYSTEM not set. I tried to do my homework to fix that, but got lost, and decided to go with an HTTPS URL instead. I have Apache set up anyway, it works like I want it to, might as well make use of that.
  • Even with Apache (and finally figuring out how to tell git to accept my self-signed cert without complaining), git was saying that it can't find a repo at URL https://git.beastie.localdomain/freebsd_kde/! I tried https://git.beastie.localdomain/freebsd_kde/ports.git, but got same error. But to my surprise, the URL https://git.beastie.localdomain/freebsd_kde/.git worked - until I started verifying what was actually pulled in, and that led to my creation of this thread.
What I'm trying to achieve here is based on the following considerations:
  • command # poudriere ports -u -m git+https -M /usr/ports -U $url -p freebsd_kde will pull in EVERYTHING from the $url I feed it. I only want to pull in a subset of that - a subset that I specify in a list. My solution to that is to set up my own manually-maintained repo at $url.
  • I'm just using my $HOME dir for practice - I want to iron out the details before letting Poudriere mess around in /usr/ports.
  • I strongly suspect I'm not setting up the 'Remote' repo right if git is not pulling in the updates that are clearly there.
 
I would try to avoid having /.git/ anywhere in the paths. Normally, ".git" is a hidden directory that is created by git. You shouldn't use that ".git" anywhere in a command, nor alter or create it by hand, unless in very special cases. Each git repo has a .git directory, but that is for the git tool to handle.

I have no idea what happens if you clone the .git, I'm not very skilled in git, but never seen that before. Try using a normal name, not hidden and other than git, leave the .git for git to handle. This line looks strange, never seen something like that:

git clone https://git.beastie.localdomain/freebsd_kde/.git

Example:
git clone https://github.com/RoGeorge/Delta-Sigma_versus_PWM <-- normal
git clone https://github.com/RoGeorge/Delta-Sigma_versus_PWM/.git <-- I never did that
 
I would try to avoid having /.git/ anywhere in the paths. Normally, ".git" is a hidden directory that is created by git. You shouldn't use that ".git" anywhere in a command, nor alter or create it by hand, unless in very special cases. Each git repo has a .git directory, but that is for the git tool to handle.

I have no idea what happens if you clone the .git, I'm not very skilled in git, but never seen that before. Try using a normal name, not hidden and other than git, leave the .git for git to handle. This line looks strange, never seen something like that:

git clone https://git.beastie.localdomain/freebsd_kde/.git

Example:
git clone https://github.com/RoGeorge/Delta-Sigma_versus_PWM <-- normal
git clone https://github.com/RoGeorge/Delta-Sigma_versus_PWM/.git <-- I never did that
Let's stick with plain git, rather than invite Github into the mix. And, as I said earlier, git was unable to find the repo when given a 'normal' URL like what you suggest. This is partly why I'm thinking, maybe I didn't set up my 'remote' server correctly for sharing my updates.
 
In this case, "github.com" is the same as "git.beastie.localdomain". If you scroll over the first pics, in the middle of the github doc linked, there is an example of how a clone command from a remote repo should look like (i.e. no .git at the end):
  • Change the current working directory to the location where you want the cloned directory.
  • Type git clone, and then paste the URL you copied earlier.
    $ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
  • Press Enter to create your local clone.
    $ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
    > Cloning into `Spoon-Knife`...
    > remote: Counting objects: 10, done.
    > remote: Compressing objects: 100% (8/8), done.
    > remove: Total 10 (delta 1), reused 10 (delta 1)
    > Unpacking objects: 100% (10/10), done.
GitHub is different only in its web GUI. The command line stays the same, either for github, gitlab or beastie localdomain. For the git in a terminal, there is no difference, so the same clone command.

It was to prove the "don't add .git when cloning" with an example. I never used poudriere, so I put a random repo of mine which I happen to have there.

Indeed, your server is not set properly if cloning doesn't work without ".git"
 
In this case, "github.com" is the same as "git.beastie.localdomain". If you scroll over the first pics, in the middle of the github doc linked, there is an example of how a clone command from a remote repo should look like (i.e. no .git at the end):

GitHub is different only in its web GUI. The command line stays the same, either for github, gitlab or beastie localdomain. For the git in a terminal, there is no difference, so the same clone command.

It was to prove the "don't add .git when cloning" with an example. I never used poudriere, so I put a random repo of mine which I happen to have there.

Indeed, your server is not set properly if cloning doesn't work without ".git"
Yeah, and I'm trying to figure out where I went wrong. Maybe there's a config value I set incorrectly, maybe I missed some git command when creating a repo from scratch for publishing. But my biggest problem is that after cloning, git log is supposed to produce identical results for both 'remote' and 'local' - and it doesn't, as you can see from OP.
--
Verifying actual files in both locations only confirms the problem.
 
Try using to use - a for the commit. It's hard to tell for sure due to lack of details. Also, why are you doing this as root? That could turn into an issue of its own.
Tried that, still no go, git log at local repo still shows just the first commit, while the remote shows that and later commits.
 
file:///usr/local/poudriere/ports/freebsd_kde gave me the error: GIT_DISCOVERY_ACROSS_FILESYSTEM not set.
Well, then either /usr/local/poudriere/ports/freebsd_kde or your current directory (for enaything except clone) isn't a git repository. ?
I only want to pull in a subset of that - a subset that I specify in a list. My solution to that is to set up my own manually-maintained repo at $url.
This sounds like a cumbersome idea. There are quite some commits to ports that
  • aren't local to just one port or
  • aren't independent of other commits

What you could do is use a quarterly branch of a clone and create a local branch on that where you cherry-pick some commits from main, similar to what's officially done with MFHs.
 
Conclusion, I need to do some small-scale practice setting up a repo from scratch before coming back to this.
--
I want to serve stuff up properly. I want git clone to see stuff that I set up. If git clone is not working right, that means initial setup was not done right.
--
I wonder why it's so difficult to explain that I want to not just clone an existing repo, but to set up my own, from a much earlier point. Even the FreeBSD repos only got migrated to git very recently, somebody needed to make sure that they're set up so that the git client sees (and gets) stuff from the server correctly.
--
I know it's cumbersome, but that's my project. ?
 
From what I recall when I setup my own self-hosted git server, it does matter how you setup the remote host. In general, I followed some tutorials I found on the web and it worked in a fashion (I will explain the side effects that I didn't find out till later).
In general, all the references I found on setting up your own git server; it has you first perform
git init --bare then adding/setting the remote connection, and lastly having you push/pull to transfer the contents.
The --bare option specifically sets up an empty repository at that location.

Now the issue/side effect I found out from this, is how git stores the contents; in that if you ls that directory it WON'T have anything besides the standard .git directory contents. This is not saying, it doesn't have the stuff, as it does, it is more of git transfers/keeps the binary diffs of the contents.

A suggestion if you want to access the files on both hosts, you may want to temporarly start the git server on the original host to share it; and have the remote host clone it from the original one. As doing the git clonewill create the actual files besides the usual .git files.
 
The --bare option specifically sets up an empty repository at that location.
Not quite correct, what --bare does is create a repository without a working copy. This isn't strictly necessary, you can push and pull to/from any repository with Git. But in the presence of a working copy, pushing can cause various problems (and definitely won't ever update the working copy). For a repository that's meant to be accessed only from remote, you should use --bare.
 
Is there a way to set things up without the push option? I want to avoid having 3 copies of the repo - one to work in, then a 'remote' one to push my changes to, and then from that 'remote' to pull my changes into /usr/ports?

I want just the 'remote', to pull my changes from. Everything happens on one host anyway.
 
After some reading on the Internet (including https://git-scm.com/docs/git-push), I think I discovered a solution to my scenario in this blog:
Seems like git push is unavoidable, but still it may be still possible to avoid 3 copies taking up a lot of space. So, if I do something like
Code:
# pwd
/usr/local/poudriere/ports/freebsd_kde
# git clone --bare ../freebsd_kde ports.git
# git push ./ports.git master
and
Code:
# pwd
/home/astyle
# git clone https://git.beastie.localdomain/freebsd_kde/ports.git

Then # git clone will pick up all the commits... or is something else missing?
 
Not sure if I understood the issue, it seems a git push is missing.
git push was definitely the missing piece. It took playing with git and a toy repo (and having 3 terminal windows open) to learn that. Yeah, I can keep doing cd to the correct directory, and keep doing that forever and not get anywhere.

So, RoGeorge and Zirias , thanks for helping me get unstuck! ?
 
Back
Top