How do I do an initial push to a remote repository with Git?
On server:
mkdir my_project.git
cd my_project.git
git --bare init
On client:
mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin [email protected]:/path/to/my_project.git
git push origin master
Note that when you add the origin, there are several formats and schemas you could use. I recommend you see what your hosting service provides.
You can try this:
on Server:
adding new group to /etc/group
like
(example)
mygroup:1001:michael,nir
create new git repository:
mkdir /srv/git
cd /srv/git
mkdir project_dir
cd project_dir
git --bare init (initial git repository )
chgrp -R mygroup objects/ refs/ (change owner of directory )
chmod -R g+w objects/ refs/ (give permission write)
on Client:
mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin [email protected]:/path/to/my_project.git
git push origin master
(Thanks Josh Lindsey for client side)
after Client, do on Server this commands:
cd /srv/git/project_dir
chmod -R g+w objects/ refs/
If got this error after git pull:
There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream new origin/<branch>
try:
git push -u origin master
It will help.