Difference between revisions of "Git -- new repository setup"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
== Set up new repository == | |||
Note that the URL in my case is defined via ~/.ssh/config. I write it directly into .../[repo]/.git/config. | 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: | On server, as user git: | ||
< | <pre> | ||
mkdir my_project.git | mkdir my_project.git | ||
cd my_project.git | cd my_project.git | ||
git --bare init | git --bare init | ||
</ | </pre> | ||
On client: | On client: | ||
<code>mkdir my_project | <code>mkdir my_project | ||
Line 19: | Line 19: | ||
<code>[https://stackoverflow.com/questions/2337281/how-do-i-do-an-initial-push-to-a-remote-repository-with-git<nowiki>]</nowiki></code> | <code>[https://stackoverflow.com/questions/2337281/how-do-i-do-an-initial-push-to-a-remote-repository-with-git<nowiki>]</nowiki></code> | ||
== Clone existing repository == |
Revision as of 22:22, 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]