I am trying to follow the steps on Deployment as described in the manual of Academic-Hugo. The goal is to upload the Hugo website to GitHub pages.
However the following step fails and I have no clue what the issue could be:
$ git submodule add -f -b master https://github.com/<USERNAME>/<USERNAME>.github.io.git public
Reactivating local git directory for submodule 'public'.
fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it
Unable to checkout submodule 'public'
The .gitmodules file looks like this (not sure how relevant that is though...):
[submodule "themes/academic"]
path = themes/academic
url = https://github.com/gcushen/hugo-academic.git
[submodule "public"]
path = public
url = https://github.com/<USERNAME>/<USERNAME>.github.io.git
branch = master
While <USERNAME> is my actual username of course.
I am new to Hugo and github pages and would appreciate any pointers on how to resolve this or even where to look for the root of the issue.
I had the same issue. I tried to continue on anyway and it ended up working:
site $ hugo
site $ cd public/
site/public $ git add .
site/public $ git commit -m "initial build"
site/public $ git push # After this, all is well.
I did run a git status prior to pushing, but it had a warning (don't recall the message) and suggested I remove the remote origin. I ignored that too.
Had the same issue today and landed on this site that has some useful info about deleting modules and re-doing the whole thing from start. Hope it might be useful to others as well.
Related
Remote repo has made some changes to project settings (added new folder and changed include path). How do I pull these settings into my repo please? I tried
git pull --rebase origin master
And then build the c++ codebase but the build throws "File not found". Appreciate any help this beginner can get.
It is indeed git pull origin master but:
check first git is recognized in your current shell and $PATH
git version
check you are in your local repository
cd /path/to/local/repo
git remote -v
git pull --rebase origin master
I have a static site generated using Zola and I'm using GitHub Actions to do a build of my static site and publish that into a gh-pages branch of my repository. I have also configured my project to serve via GitHub pages using the gh-pages branch.
The problem I'm facing is that as soon as my GitHub action builds a new version and pushes it to the gh-pages branch, the custom domain setting in the GitHub settings gets reset.
Here is what I do in my GitHub action to build and push to TARGET_BRANCH (gh-pages) branch:
- name: Commit and push to target branch
run: |-
git config --global user.email "workflow-bot#mydomain.com"
git config --global user.name "workflow-bot"
git checkout --orphan $TARGET_BRANCH
rm -rf .github/
mv public ..
rm -rf *
mv ../public/* .
touch .nojekyll
touch README.md
echo 'https://www.bigelectrons.com - SITE GENERATED USING ZOLA' > README.md
git add .
git commit -m "generated using zola build"
git push --set-upstream origin $TARGET_BRANCH --force
Any idea what the problem is and how I could resolve th
I just had to add a CNAME file to my gh-pages branch. For example., in the run command, I had to add these two lines:
touch CNAME
echo 'mydomain.com' > CNAME
I know this is not Zola-related, but I've stumbled upon the same error when using Mkdocs.
The documentation says that you need to create a CNAME file in your docs_dir directory, so that their gh-deploy script can pick that up and copy it at the right place in the gh-pages branch (see that doc here).
For information, using the Github developer settings page to set the custom domain does exactly the same thing, ie. creating a CNAME file at the root of the gh-pages branch.
I am new to GIT hub version Controlling System.
I am working on a project which i downloaded as zip from GIT hub. It is not a git repository. What i want to do is that I want to make it a git repository and want to pull the existing git repository in it when issuing a git pull command.
I want to create my own Development Branch, develop code on local, push code to github, then do a pull request
Help will be highly appreciated.
Since you don't have any history of your changes to preserve I think your best bet is to clone the repo normally, and then copy your changes into that repository. Your question is a bit sparse on details, but something like the following should work
git clone <git hub project> <new folder on your system>
# maybe you can use a tag here for the SHA
git checkout -b my_branch SHA_THAT_REPRESENTS_YOUR_ZIP_DOWNLOAD
cp -r <your existing directory> <your new git repository>
git status # abort if this step doesn't look right
git add # add all your changed files
git commit # commit your work
git rebase <main dev branch> # catch up
I am using webfaction for my web deployment.
I have a Django app at: webapps/django_app/project_name/
I have a Git repo at: webapps/git_app/repos/my_repo.git
my_repo.git is a bare repository. It is not a working directory.
whenever I push from my local development computer to the remote (webfaction --> my_repo.git), I want my django_app to get the pushed code.
I followed this post which works fine. But no explanation of how this works is given.
I have added these two lines in post_recieve hook in my_repo.git.
#!/bin/sh
GIT_WORK_TREE=/home/username/webapps/django/myproject git checkout -f
GIT_WORK_TREE=/home/username/webapps/django/myproject git reset --hard
what does this two lines actually do?
Moreover, my Djangoapp folder is not a git repo. still whenever push is made to my_repo.git, Djangoapp gets updated. so how does it work?
When you are managing files locally with .git, you typically have two things:
Your git repository, which is contained in the .git directory, and
Your work tree, which is the set of files you are actually editing.
By default, the repository is a subdirectory of the work tree, but this is not a requirement. Setting the GIT_WORK_TREE environment variable directs git to use a different location for your checkout out files.
So the first line...
GIT_WORK_TREE=/home/username/webapps/django/myproject git checkout -f
...is asking git to check out the HEAD of the repository into /home/username/webapps/django/myproject.
The second line...
GIT_WORK_TREE=/home/username/webapps/django/myproject git reset --hard
...makes sure that /home/username/webapps/django/myproject does not have any local changes. reset --hard discards any changes to files that are tracked by git. By "local changes" I mean any changes that you or someone else has made to files in this directory; ideally, there won't be any, but if there were some there, reset -f makes sure that the modified files are overwritten with the version of the file stored in the repository.
For more details on any of the commands listed here, try running git <command> --help for the man page, or see The Git Book.
After copying a folder 'myapp' into to my working folder, I do the following to add it to my staging area:
git add .
and then commit the changes:
git commit
Then I push my changes to Heroku:
git push heroku master
So my folder, called 'myapp' is present on heroku, but the problem is that it's completely empty.
When I do the following,
git clone myapp myapp2
the folder clones properly on my local machine with all expected subcontents.
Does anyone know why the subfolders' contents are not being pushed to Heroku properly? What am I doing wrong?
To answer the questions below:
I am doing the git add . in my top level folder (the folder that contains folder myapp). Doing git status shows `no changes added to commit (use "git add" and/or "git commit -a")
Yes, myapp contains files/folders (my django project)
I deleted my .gitignore file because I placed my virtual environment in another place altogeher so it's no longer in my project folder so I don't think that's affecting it.
Ok, I seemed to have solved the problem. Somehow git got in a weird state. I don't really understand how, but for some reason it wasn't adding any of the files in the folder.
I simply copied that folder and gave it a new name, and then followed the exact same process I had been doing all along, and it finally uploaded properly.
By default, you cannot push changes to a checked-out branch of a repository. It usually causes major problems! Here is what usually happens:
$ git push heroku master
...error messages...
To heroku
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'heroku'
Since you haven't mentioned any error messages, I'm assuming that you've added the following to your heroku repository configuration, or you're running a fairly old version of Git:
[receive]
denyCurrentBranch = false
It sounds like you want to check out a fresh copy of the master branch whenever you push a new version to your heroku repository. That can be achieved with a post-receive hook. Create a file in your heroku repository .git/hooks/post-receive, and give it +x permissions.
#!/bin/sh
while read oldrev newrev refname
do
if test "$refname" = refs/heads/master
then
( cd ..; GIT_DIR=.git; git reset --hard )
fi
done
Now, whenever you push a new master branch to heroku, the hook will run and check out the new branch. There are better ways to do this kind of thing, but this is simple.
Summary: By default, when you push changes, it only changes the history but not the working tree. The assumption is that someone might be working on that tree, so doing anything to it could be destructive.