Git Config file and setup not allowing pull from github and push to dreamhost

Viewed 51

.git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = git@github.com:myusername/wp-theme.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
    remote = dreamhost
    merge = refs/heads/main
[remote "dreamhost"]
    url = ssh://myusername@server.domain.com/~/my.domain.com.git
    fetch = +refs/heads/*:refs/remotes/dreamhost/*

I am having a hard time pulling my code from github and pushing it to my dreamhost server.

I run (on my local computer)...

 git push -u dreamhost main

and then run (on the server)..

git clone ~/my.domain.com.git ~/cloned.my.domain.com.git

However the folder is empty. What am I doing wrong?

1 Answers

In your empty cloned repository folder ~/cloned.my.domain.com.git, check the output of:

git branch -avv

The idea is: your local computer might have a recent Git, with a default branch of main.
While your target bare repository (~/my.domain.com.git) might have as default branch master.

If you push the main branch, but, on the target side, clone the default master branch, the latter would have no commit/file to show.
You would need to go back to the bare repository (~/my.domain.com.git), and change its default branch.

If origin/main is present:

git checkout main
Related