• Shopping Cart Shopping Cart
    0Shopping Cart
London App Developer
  • Courses
  • Consulting
  • Tutorials
  • About
  • Click to open the search input field Click to open the search input field Search
  • Menu Menu
Computer devices connected to a virtual network
Git

Creating central git repository

Cloud based source control systems such as github are a great addition to the everyday toolkit of the software engineer. However, what if you want to host your own local git repository? Maybe for security, budget limitations of just personal preference?

This post will explain how you can do just that. During this explanation I am using Debian 7, but it should work on other operating systems too.

Let’s get started.

1. Install git

sudo apt-get install git

2.  Create a directory. The name does not matter at this point, since this will only be a temporary directory. I named mine ‘git_project’ and stored it in my home folder.

cd ~
mkdir 'git_project'

3. Now initialise the temp folder as a repository.

cd ~/git_project
git init

4. Now copy the files you want to initialise the repository with into this temp directory. If you plan to add files later, just create a temp file.

cd ~/git_project
touch initial.temp

5. Now add all the files in the repository.

git add *

6. Next, commit the files as the initial commit.

git commit -m 'Initial Commit'

7. Now set it to a bare repo. This means that only the bare git repository will be stored, and not the source code files.

git config --bool core.bare true

8. Now move the hidden git file to your central repository location (I store mine in ~/repo). At the same time give it a project name.

mv .git ~/repo/myproject.git

9. You can now clone this repository using the command line.

git clone user@host.com:/home/user/repo/myproject.git

That’s it. In a future post I’ll explain for you can integrate this with an IDE.

Share this entry
  • Share on Facebook
  • Share on X
  • Share on WhatsApp
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Vk
  • Share on Reddit
  • Share by Mail
https://i0.wp.com/londonappdeveloper.com/wp-content/uploads/2014/04/Creating-central-git-repository.png?fit=277%2C223&ssl=1 223 277 mark https://londonappdeveloper.com/wp-content/uploads/2018/12/lon_website_logo-300x110.png mark2014-04-18 08:38:512021-04-09 22:02:28Creating central git repository

Pages

  • About
  • Consulting
  • Home
  • Tutorials

Categories

  • AI
  • Android
  • Android Studio
  • Angular
  • Aptana Studio
  • AWS
  • Bootstrap
  • Career advice
  • Celery
  • Databases
  • Deployment
  • DevOps
  • Django
  • Django REST Framework
  • Docker
  • Eclipse
  • Getting Help
  • Git
  • Git Bash
  • Git Flow
  • GitHub Actions
  • Google App Engine
  • IDE
  • Ionic Framework
  • iOS
  • JavaScript
  • Job Search
  • Links
  • Linux
  • Mac OS X
  • macOS
  • Node.JS
  • OpenAI
  • PGAdmin
  • Postgres
  • Productivity
  • Python
  • React
  • Salt Stack
  • Stack Overflow
  • Tools
  • Travis-CI
  • Tutorials
  • Ubuntu
  • Uncategorized
  • Vagrant
  • VSCode
  • WebSockets
  • Windows 10
  • WordPress

London App Developer Ltd,

71-75 Shelton Street, Covent Garden, London, United Kingdom, WC2H 9JQ

Company registration number: 09718346

© London App Developer - London App Developer Ltd, Company Registration Number: 09718346, VAT: GB224061842
  • Link to X
  • Link to Youtube
  • Link to Facebook
  • Link to Reddit
Link to: How to use Scroll View in Xcode 5 Storyboards Link to: How to use Scroll View in Xcode 5 Storyboards How to use Scroll View in Xcode 5 StoryboardsThe words xcode 5 on a blue background image Link to: How to add an SSH public key to your Linux user account Link to: How to add an SSH public key to your Linux user account Linux penguin logo in front of textHow to add an SSH public key to your Linux user account
Scroll to top Scroll to top Scroll to top

This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.

OKLearn more

Cookie and Privacy Settings



How we use cookies

We may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.

Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.

Essential Website Cookies

These cookies are strictly necessary to provide you with services available through our website and to use some of its features.

Because these cookies are strictly necessary to deliver the website, refusing them will have impact how our site functions. You always can block or delete cookies by changing your browser settings and force blocking all cookies on this website. But this will always prompt you to accept/refuse cookies when revisiting our site.

We fully respect if you want to refuse cookies but to avoid asking you again and again kindly allow us to store a cookie for that. You are free to opt out any time or opt in for other cookies to get a better experience. If you refuse cookies we will remove all set cookies in our domain.

We provide you with a list of stored cookies on your computer in our domain so you can check what we stored. Due to security reasons we are not able to show or modify cookies from other domains. You can check these in your browser security settings.

Google Analytics Cookies

These cookies collect information that is used either in aggregate form to help us understand how our website is being used or how effective our marketing campaigns are, or to help us customize our website and application for you in order to enhance your experience.

If you do not want that we track your visit to our site you can disable tracking in your browser here:

Other external services

We also use different external services like Google Webfonts, Google Maps, and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.

Google Webfont Settings:

Google Map Settings:

Google reCaptcha Settings:

Vimeo and Youtube video embeds:

Other cookies

The following cookies are also needed - You can choose if you want to allow them:

Privacy Policy

You can read about our cookies and privacy settings in detail on our Privacy Policy Page.

Privacy Policy
Accept settingsHide notification only