176.3. Sharing Repositories with others

简介:

176.3.1. Setting up a git server

First we need to setup a user with a home folder. We will store all the repositories in this users home folder.

		
sudo adduser git
		
		

Rather than giving out the password to the git user account use ssh keys to login so that you can have multiple developers connect securely and easily.

Next we will make a repository. For this example we will work with a repository called example. Login as the user git and add the repository.

login to remote server

		
ssh git@REMOTE_SERVER
		
		

once logged in

		
sudo mkdir example.git
cd example.git
sudo git --bare init
Initialized empty Git repository in /home/git/example.git/
		
		

That’s all there is to creating a repository. Notice we named our folder with a .git extension.

Also notice the ‘bare’ option. By default the git repository assumes that you’ll be using it as your working directory, so git stores the actual bare repository files in a .git directory alongside all the project files. Since we are setting up a remote server we don’t need copies of the files on the filesystem. Instead, all we need are the deltas and binary objects of the repository. By setting ‘bare’ we tell git not to store the current files of the repository only the diffs. This is optional as you may have need to be able to browse the files on your remote server.

Finally all you need to do is add your files to the remote repository. We will assume you don’t have any files yet.

		
mkdir example
cd example
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@REMOTE_SERVER:example.git
git push origin master
		
		

replace REMOTE_SERVER with your server name or IP




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
Java Maven
Maven 3.8.1 报错 Blocked mirror for repositories
Maven 3.8.1 报错 Blocked mirror for repositories
1016 0
Maven 3.8.1 报错 Blocked mirror for repositories
|
4月前
|
iOS开发 Perl
解决Xcode报错Stored properties cannot be marked unavailable with ‘@available‘
解决Xcode报错Stored properties cannot be marked unavailable with ‘@available‘
52 0
|
5月前
|
缓存 安全 前端开发
CORS(Cross-Origin Resource Sharing)
CORS(Cross-Origin Resource Sharing)
|
7月前
|
存储
Build was configured to prefer settings repositories over project repositories but repository
Build was configured to prefer settings repositories over project repositories but repository
356 5
|
7月前
|
Java Maven
The goal you specified requires a project to execute but there is no POM in this directory
The goal you specified requires a project to execute but there is no POM in this directory
262 0
|
7月前
|
SQL OLAP
Automatic Workload Repository Views
Automatic Workload Repository Views
33 0
|
7月前
|
存储 SQL API
TinyKv Project4 Transactions
TinyKv Project4 Transactions
109 0
Automatic Workload Repository Views
Automatic Workload Repository Views
96 0
|
SQL Oracle 关系型数据库
Troubleshooting: Missing Automatic Workload Repository (AWR) Snapshots and Other Collection Issues (Doc ID 1301503.1)
Troubleshooting: Missing Automatic Workload Repository (AWR) Snapshots and Other Collection Issues (Doc ID 1301503.1)
769 0
|
存储
1032. Sharing (25)
#include using namespace std; /* 题目大意:求两个链表的首个共同结点的地址。如果没有,就输出-1 分析: 用结构体数组存储,node[i]表示地址为i的结点 key表示值,next为...
890 0