Creating a git repository from an existing project
Jump to navigation
Jump to search
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