Build error "file not found" after git pull --rebase origin master - c++

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

Related

Git submodule failure when building pages with Hugo

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.

fatal: destination path '.' already exists and is not an empty directory

I'm getting this error when I try to git clone my Bitbucket repo from my remote Digital Ocean server. The server directory I'm trying to clone the repo into is not empty, as I'm setting up my Django project in it (env, static, manage.py etc are all in there). So how do I clone the repo into this directory that is not empty?
I've already tried a reccommended answer which said use git fetch and git checkout -t origin/master -f - and that didn't work - I got this error:
fatal: A branch named 'master' already exists
Any suggestions what I can do?
If I understand well, you have a folder in which you already have files that will be part of what you will clone.
What you can do is :
Initialize your folder as a GIT repository
git init
Stash all your files in your folder
git stash save -u
Add your remote repository URL
git remote add myremotepository git#github.com:X/Y.git
Pull the stuff :)
git pull myremoterepository master
Reapply the files you stashed
git stash pop (or git stash apply if you want them to still be in the stash memory)
Make sure the name of the project on your computer is different from the repo name. If they are the same, cloning will be impossible. E.g you could name your repo as project_java and the actual name of the project on your computer could be project

git pull origin master returns "Already up-to-date" even though it isn't

I'm using git pull origin master to pull my Bitbucket repo onto my Digital Ocean Django server directory (which already has some folders for Django like env and static) . When I do this it says Already up-to-date. but the repo didn't come through? I'm not sure if I'm misinterpreting what git pull does but I assumed it took the contents of mu repo and merged with my current directory. If this isn't true, can somebody explain what other command I should do to achieve this?
Have you set the origin at the first place, from where you want to pull the git repo. If not, then you should set the origin, first.
git remote add origin <link to your git repository>
for eg., git remote add origin https://github.com/gitaccname/gitproject.git
or, git remote add origin git#github.com:gitaccname/gitproject.git
After that, you can pull your git repository into whichever server you like, using the command.
git pull origin master

Add an existing origin to a django project and pull the existing repo in it.

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

post_receive hook in git: how does it checkouts my non-git folder?

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.