Git: Difference between revisions

From wikipost
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:


[[Creating a git repository from an existing project]]


[[setting aliases]]
===creating a git repository from an existing project===


[[setting global variables]]
Assuming a project in ~/myproject containing all sorts of files and directories


[[bash git-prompt]]


[[branches]]
<pre>
In the below example we use a local project called 'myproject' and upload it to the git server.

- if the existing local 'myproject' isn't initialised with git yet, then do so now:
$ git init
$ git add .
$ git commit -m "initial commit"


- clone 'myproject' from your local project into a new local directory called 'myproject.git'

$ git clone --bare myproject/ myproject.git

- upload the new repository to the remote server

$ scp -r myproject.git/ git@gitserver:/home/git

(this will create the folder /home/git/myproject.git on the server)


you may now clone the repository directly from the server into a local folder

$ cd somedir
$ git clone git@gitserver:myproject (the .git extension is not required)

lastly, you may now remove the original 'myproject' dir locally

</pre>

Latest revision as of 22:43, 13 February 2024