Accessing the private Git repo

From One-Eyed Man Wiki
Jump to navigation Jump to search

Accessing the private Git repo

Here is a record of some commands involved in setting up and using the Negit-based Git server. Setup instructions from the Git animal book were used (eventually).

First, creating client repos when the server (Negit) already exists and is populated.


1. If possible, to simplify matters, copy over the config files from an existing setup. For example:


[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = ssh://git@negit/home/git/cryptopals
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

The crucial thing in manually creating a file off of this model is to get the name of the repo correct. In this case, the repo on the server is defined by "cryptopals.git". Case sensitive. Drop the extension.

2. Create and initialize the repos.

mkdir ~/git
mkdir ~/git/repo1  # name doesn't matter, though in proactice it should make sense
mkdir ~/git/repo2

3. Initialize the repos.

cd ~/git/repo1
git init

(etc.)

4. If you don't have the ready-made config, you have to add a target server:

cd ~/git/repo1
git remote add origin ssh://git@negit/home/git/YubiCity.git

(etc. for other repos)

Then do:

git pull origin master

Branches will then have to be set up manually.

If you do have the ready-made config:

  1. Replace or edit ~/git/repo1/.git/config
  2. Go back up to ~/git/repo1
  3. Do: git pull

This will bring down everything, including hooks for the branches.

Next, a record of setting up the server (as user "git").

mkdir yubi
cd yubi
git init
cd ..
exit
cd
cd yubi
git init
git status
git config --bool core.bare true
git status
ls -al
ls
git status
git init
ls
ls -al
git branch test
git checkout test
git status
git checkout master
git status
ls
pico .git/config
git config --bool core.bare true
git status
ls -al
cat lalalala 
ls
git checkout master
ls -al 
pico .git/config
git init 
ls
git status
git commit -a
cat .git/config 
git status
ls
git branch
git checkout test
git checkout master
ls
ls -al
cd ..
ls
ls -al
ls YubiCity/
git clone --bare YubiCity YubiCity.git
git clone --bare ~/YubiCity YubiCity.git
ls
git clone --bare YubiCity YubiCity.git
cd YubiCity/
git init
ls
ls -al
cd ..
git clone --bare YubiCity YubiCity.git
ls
rm -r YubiCity
rm -r YubiCity*
ls
cd YubiCity/
git init
git status
git add *
git status
git commit -a
git status
ls -al
cd ..
git clone --bare YubiCity YubiCity.git
ls -al
rm -r yubi