Git set up a public repository

If you have to set up a public repository with git you can follow the instruction found on the git-core tutorial
(Hint: Search for “Publishing your work”)

Things to keep in mind:

  • Public repository are usually named as project.git and it’s a directory even if you can be mislead to think it’s a file for the extension (.git). Well, it’s not a file.
  • you need to login in the remote host (the one from which you will share your repo) and initialized a local git database:
    • ssh account compulsory
    • git should be in the path and available in the web server
  • You need an ssh account over there.
  • Then you can push your changes to the new shiny repo.

The steps to do that:

  1. login the remote <public-host>
  2. mkdir project.git
  3. GIT_DIR=my-git.git git init
  4. mv project.git/hooks/post-update.sample project.git/hooks/post-update This make sure that after every push the git update-server-info is ran and your repo can be accessed in the public way.
  5. git push <public-host>:/path/to/project.git master

1 Comment

  1. Thank you, this is interesting.
    I have tried to set up a common repository for all us in my group, but in the end I have decided to use github and a paid account.

Leave a Reply

© 2023 Train of Thoughts

Theme by Anders NorénUp ↑

By continuing to use the site (scrolling or clicking counts), you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.