Thursday, 11 October 2012 15:33

Creating a bare Git repository and uploading an existing (non git) project to it.

I needed to create bare Git repos in order Gitify local projects and publish them here.

These are my notes on how to do it.

Web-server side

Create a project folder for the project with the extension .git (this seems to be the convention for a bare repository).

mkdir project.git

Next initialise a bare repo. 

cd project.git
git --bare init

Local workstation side

Enter the project directory and initialise it as a git repo.

cd project
git init


Set the repo as remote.

git remote add origin This email address is being protected from spambots. You need JavaScript enabled to view it.:~/project.git


Add the local project files to the project and make the initial commit. (See the notes on line endings)

git add -A -v
git commit -m "Initial Commit"


Push the changes to the remote server.

git push -u origin master

 

Notes

Setting a username etc.

git config --global user.name "Your Name"
git config --global user.email This email address is being protected from spambots. You need JavaScript enabled to view it.
git commit --amend --reset-author

For the viewgit web based interface

Edit the localconfig.php script in viewgit/viewgit/localconfig.php. Add the new project to the projects array.

Last modified on Friday, 19 October 2012 18:44

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.