Creating a git repository from an existing project: Difference between revisions

From wikipost
Jump to navigation Jump to search
(Created page with " ===creating a git repository from an existing project=== Assuming a project in ~/myproject containing all sorts of files and directories <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 di...")
 
No edit summary
Line 1: Line 1:



===creating a git repository from an existing project===


Assuming a project in ~/myproject containing all sorts of files and directories
Assuming a project in ~/myproject containing all sorts of files and directories

Revision as of 01:35, 9 February 2024


Assuming a project in ~/myproject containing all sorts of files and directories


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