How can I host Git repositories and manage my content-hosting myself?

后端 未结 2 972
天涯浪人
天涯浪人 2020-12-12 02:19

Things such as Github, Bitbucket, DropBox -- manages the content-hosting such as tickets and repo -hosting (DB not tickets but can be used to store repos). I want a solution

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 02:44

    If you're running a Linux server an option is to use Git + SSH.

    On The Server

    1. Create a user account called git which has permissions over your main git project directory. This is useful for allowing all collaborators to push on shared projects.

    2. Add the RSA public key for each of your client machines to the authorized_keys file on the server. (You can generate a private-public key pair using ssh-keygen -t rsa -b 4096 on most Linux distributions.)

    3. Create a new bare repository for your project as the git user. git init myproject --bare

    On the Client

    1. Turn on private key authentication by enabling the IdentifyFile in your ssh_config.

    2. Clone the bare repository. git clone git@:/var/git/myproject

    3. Make your changes.

    4. Commit the changes and push them back to the remote repo. git push origin master

    If you need more specific instructions (such as the exact commands to create a user account) checkout the official Pro Git book.

提交回复
热议问题