Reputation: 126767
On a new laptop running Git 2.24.3 (Apple Git-128), I notice that whenever I clone a repo, I don't get a remote (and hence remote tracking branch) setup:
$ git clone git@gitlab.com/myuser/myproject.git
Cloning into 'myproject'...
remote: Enumerating objects: 70, done.
remote: Counting objects: 100% (70/70), done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 70 (delta 34), reused 63 (delta 27), pack-reused 0
Receiving objects: 100% (70/70), 180.33 KiB | 124.00 KiB/s, done.
Resolving deltas: 100% (34/34), done.
$ cd myproject
$ git status
On branch master
nothing to commit, working tree clean
$ git remote -vv
$
$ git branch -a
* master
$ ls -l .git/refs
total 0
...redacted... heads
...redacted... remotes
...redacted... replace
...redacted... tags
$ ls -l .git/refs/remotes
$
Is there some setting somewhere I need to change? It's a bit tedious having to manually create a remote each time when I always want to push back from where I cloned.
The documentation clearly says this should be happening:
Clones a repository into a newly created directory, creates remote-tracking branches for each branch in the cloned repository (visible using git branch -r), and creates and checks out an initial branch that is forked from the cloned repository's currently active branch.
I'm getting the active branch checked out, but no remote.
Upvotes: 2
Views: 908
Reputation: 535989
So the problem turns out to be that you are using git filter-repo
. That can indeed remove your remote (as discussed, for example, here: How to modify remote history with git filter-repo?).
Upvotes: 5
Reputation: 1329112
I would try first:
~/.gitconfig
(check with git config -l --show-origin
if there are any other location to purge)That way, you can check if the issue persists with a recent Git and a clean configuration.
Upvotes: 0