Difference between revisions of "Git -- new repository setup"

From One-Eyed Man Wiki
Jump to navigation Jump to search
Line 21: Line 21:


== Clone existing repository ==
== Clone existing repository ==
On client, as regular user:
  <pre>
  <pre>
cd ~/git
  git clone git:/home/git/project.git</pre>
  git clone git:/home/git/project.git</pre>

Revision as of 22:29, 9 September 2023

Set up new repository

Note that the URL in my case is defined via ~/.ssh/config. I write it directly into .../[repo]/.git/config.

On server, as user git:

 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 youruser@yourserver.com:/path/to/my_project.git
 git push origin master
[https://stackoverflow.com/questions/2337281/how-do-i-do-an-initial-push-to-a-remote-repository-with-git]

Clone existing repository

On client, as regular user:

 cd ~/git
 git clone git:/home/git/project.git