I am zero in git. Absolute zero. So there are many materials and hints on the web, however I cannot put them together.
So could some one please tell me what I have done wrong and what else I should do to achieve what I am looking for?
What I want to do is simple. I have written a project in C++ and now I want to make a local repository to have version control of all my changes. That is all I need.
I have a folder:
~/myproject
which contains my project files. and another folder to save changes inside (my local place to store changes)
~/my-local-repository
So, first of all, I have set up a repo:
cd ~/myproject
git init
then I created a .gitignore :
cd ~/myproject
touch .git/.gitignore
and excluded my bin
directory.
then I added a few files
git add this that
then I removed them
git reset
and again added some files. I changed some files and commit:
git commit -am "new change"
Then setting a dummy username and email:
git config user.name "my.phd"
git config user.email myphd@exmaple.com
Then I set the local repository folder for local changes:
git remote add local ~/my-local-repository
so I expect all my changes go here.
Now, when I push:
git push local
I get this error:
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
fatal: '/media/doc/my-local-repository' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Maybe this error is very simple to many people. But I understand nothing out of it. What have I done wrong till now and how to fix?
The error is on the line
'/media/doc/my-local-repository' does not appear to be a git repository
That folder doesn't have a git repo in it. You need to run
git init
in it. If you are working in a new local branch, you will also have to push that new branch upstream to have it appear in the remote. To do that, see this question.