一、安装Git
yum install git
然后进行配置:
useradd --home /home/git git
passwd git
创建完用户后就可以切换到git用户下进行后面的设置,如用户名和邮箱:
su git
git config --global user.name "somebody"
git config --global user.email "somebody@example.com"
设置默认将会保存在~/.gitconfig文件中。
此时,Git的功能就已经可以使用了。为了方便后面的操作,可以先来创建一个空版本库。
mkdir ~/repo
然后建立项目目录
mkdir ~/repo/huhamhire-hosts
切换到项目目录,并进行初始化
cd ~/repo/huhamhire-hosts
git init --bare --shared
如果到该项目目录中运行 git init 命令,并加上 --shared 选项,那么 Git 会自动修改该仓库目录的组权限为可写。
至此,一个初始的空项目版本库就配置完成了,后面安装了gitosis之后便可向库中推送
二、克隆git仓库
git clone git@192.168.1.128:/home/git/repo/huhamhire-hosts
yum install git
然后进行配置:
useradd --home /home/git git
passwd git
创建完用户后就可以切换到git用户下进行后面的设置,如用户名和邮箱:
su git
git config --global user.name "somebody"
git config --global user.email "somebody@example.com"
设置默认将会保存在~/.gitconfig文件中。
此时,Git的功能就已经可以使用了。为了方便后面的操作,可以先来创建一个空版本库。
mkdir ~/repo
然后建立项目目录
mkdir ~/repo/huhamhire-hosts
切换到项目目录,并进行初始化
cd ~/repo/huhamhire-hosts
git init --bare --shared
如果到该项目目录中运行 git init 命令,并加上 --shared 选项,那么 Git 会自动修改该仓库目录的组权限为可写。
至此,一个初始的空项目版本库就配置完成了,后面安装了gitosis之后便可向库中推送
二、克隆git仓库
git clone git@192.168.1.128:/home/git/repo/huhamhire-hosts
参考:
Provided that you already:
-
Setup your SSH keys with Github (Window > Preferences > General > Network Connections > SSH2)
-
Setup your local repository (you can follow this guide for that)
-
Created a Github repository (same guide)
... here's how you do it:
- Go to the Git Repositories view (Window > Show View > Other > Git Repositories)
- Expand your Repository and right click Remotes --> "Create Remote"
- "Remote Name": origin, "Configure push": checked --> click "OK"
- Click the "Change..." button
- Paste your git URI and select protocol ssh --> click "Finish"
- Now, click "Save and Push" and NOW you should get a password prompt --> enter the public key passphrase here (provided that you DID (and you should) setup a passphrase to your public key) --> click "OK"
- Now you should get a confirmation window saying "Pushed to YourRepository - origin" --> click "OK"
- Push to upstream, but this time use "Configured remote repository" as your Destination Git repository
- Go get yourself a well earned cup of coffee!