Difference between revisions of "Git -- new repository setup"
Jump to navigation
Jump to search
(Comment) |
(Adding clone info) |
||
(5 intermediate revisions by the same user not shown) | |||
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: | On server, as user git: | ||
< | <pre> | ||
cd | mkdir project.git | ||
git --bare init</ | cd project.git | ||
git --bare init</pre> | |||
On client: | On client: | ||
< | <pre> | ||
cd | mkdir project | ||
cd project | |||
touch .gitignore | touch .gitignore | ||
git init | git init | ||
git add . | git add . | ||
git commit -m "Initial commit" | git commit -m "Initial commit" | ||
git remote add origin youruser@yourserver.com:/path/to/ | git remote add origin youruser@yourserver.com:/path/to/project.git | ||
git push origin master</ | git push origin master</pre> | ||
<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 == | |||
On client, as regular user: | |||
<pre> | |||
cd ~/git | |||
git clone git:/home/git/project.git</pre> |
Latest revision as of 22:32, 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 project.git cd project.git git --bare init
On client:
mkdir project cd project touch .gitignore git init git add . git commit -m "Initial commit" git remote add origin youruser@yourserver.com:/path/to/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