Github server for linux

teocci / how-to-setup-git-server.md

Verify that Git was successfully installed on your system:

It’s highly recommended to create a new Linux user for managing the Git repositories, run:

sudo useradd -m -r -U -d /home/git-repos git

The home directory of git user is located at /home/git-repos . To increase security, we’ll create an ssh key to log in to the git user.

Switch to the log-in session of git user by running:

To create the SSH directory and file for holding the authorized ssh key for git user, run the following commands:

mkdir -p ~/.ssh chmod 700 ~/.ssh touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys

Once, the server was successfully set-up, it’s time to create a new git repository:

Configuring Git repository

Now, we have to add our local user’s public SSH key to the authorized_keys file of the git user. If we already have generated an SSH key for our local user, we can skip the following step:

Now, we can copy our public SSH key to the server by running (replace and ):

ssh-copy-id -i ~/.ssh/id_rsa.pub user>@host>

Note: Manually copy the public ssh key to the server

  • Sub-step 1: Get the public key Ask the end user to provide the public key by typing the following command:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ3GIJzTX7J6zsCrywcjAM/7Kq3O9ZIvDw2OFOSXAFVqilSFNkHlefm1iMtPeqsIBp2t9cbGUf55xNDULz/bD/4BCV43yZ5lh0cUYuXALg9NI29ui7PEGReXjSpNwUD6ceN/78YOK41KAcecq+SS0bJ4b4amKZIJG3JWm49NWvoo0hdM71sblF956IXY3cRLcTjPlQ84mChKL1X7+D645c7O4Z1N3KtL7l5nVKSG81ejkeZsGFzJFNqvr5DuHdDL5FAudW23me3BDmrM9ifUmt1a00mWci/1qUlaVFft085yvVq7KZbF2OP2NQACUkwfwh+iSTP username@hostname
mkdir -p /home/git-repos/.ssh && touch /home/git-repos/.ssh/authorized_keys

Now open this /home/git-repos/.ssh/authorized_keys file with a text editor like Vim and add the public key of the user here:

vim /home/git-repos/.ssh/authorized_keys
chmod 700 /home/git-repos/.ssh && chmod 600 /home/git-repos/.ssh/authorized_keys

We created those file with either root or our own admin accounts for some other user. So we need to change the ownership to the git user:

chown -R git:git /home/git-repos/.ssh

On our local Ubuntu 20.04 machine, assuming that you already had an unversioned directory, for example, ~/go. Change the current directory to it:

Next, you have to add a git remote to track your local repository on Git server:

git remote add origin git@git-server-ip-address:test-teo.git

Verify that your Git server was successfully installed and configured, run the following command:

cd ~/go touch README git add . git commit -m "Add file Readme" git push origin master

Источник

github local server

you can install portable GitHub system into UNIX/Linux. You can create users and repositories without limitation. . You can install Kallithea on your own server and host repositories for the version control system of your choice.

How do I setup a local Git server?

  1. Create a “git” user and group.
  2. Upload a public SSH key to the “git” user which will allow you (or others) to log in as the “git” user.
  3. Create a bare repository on the server.
  4. Add the remote repository (the one just created on the server) to a local git project.

Is GitHub server free?

GitHub Free now includes unlimited private repositories. For the first time, developers can use GitHub for their private projects with up to three collaborators per repository for free. . Public repositories are still free (of course—no changes there) and include unlimited collaborators.

How do I pull GitHub locally?

  1. Cloning the Remote Repo to your Local host. example: git clone https://github.com/user-name/repository.git.
  2. Pulling the Remote Repo to your Local host. First you have to create a git local repo by, example: git init or git init repo-name then, git pull https://github.com/user-name/repository.git.

Is GitHub a server?

I’ve already noted that GitHub is a cloud-based Git server for code hosting and social coding, and that it implements features for code review (pull requests, diffs, and review requests), project management (including issue tracking and assignment), integrations with other developer tools, team management, and .

How do I create a local Git repository?

  1. Create a directory to contain the project.
  2. Go into the new directory.
  3. Type git init .
  4. Write some code.
  5. Type git add to add the files (see the typical use page).
  6. Type git commit .

Does GIT require a server?

Git doesn’t need to be installed globally for all users on server; you can tell git where to find appropriate git binaries via relevant option (see git documentation).

How do I setup Git?

  1. Get a github account.
  2. Download and install git.
  3. Set up git with your user name and email. Open a terminal/shell and type: .
  4. Set up ssh on your computer. I like Roger Peng’s guide to setting up password-less logins. .
  5. Paste your ssh public key into your github account settings. Go to your github Account Settings.

How do I run GitLab locally?

In order to push or pull to your projects, you must add remote machine account ssh-keys to your new GitLab account. To do this, find the ssh pubkey on the remote machine—on Linux you can do this by issuing the command cat ~/. ssh/id_rsa. pub and copying the output.

Can I run my own GitHub?

Unfortunately, while GitHub is the world’s largest code hosting service; its own software is not available for others to use. It’s not open source so you can’t grab the source code and compile your own GitHub. Unlike WordPress or Drupal you can’t download GitHub and run it on your own servers.

How expensive is GitHub?

GitHub Pricing

Name Price
Free Free for Individualsper month
Team $4per month
Enterprise $21per month

Is GitHub safe?

It’s not «safe». GitHub allows anonymous users to upload anything they want including malware. You could get infected by downloading/executing code or visiting anything on the «github.io» domain where arbitrary javascript (and therefore 0-day browser exploits) might be found (github.com is safer than github.io).

How to install Webmin on FreeBSD 12

Webmin

Welcome to FreeBSD!Number of packages to be installed: 10.* Configure Webmin by running /usr/local/lib/webmin/setup.sh.* Add webmin_enable=»YES» to yo.

How To Install GNS3 on Ubuntu 20.04 Linux

Step

Installation of GNS3 on Ubuntu 20.04 (Focal Fossa) is done from a PPA repository. Install GNS3 on Ubuntu 20.04 (Focal Fossa)Step 1: Add GNS3 PPA rep.

Creating Bash Infinite Loop by Example Scripts

Loop

How do you write an infinite loop in shell script?How do you run an infinite loop in bash?How do I run a shell script continuously?How do you make an .

Latest news, practical advice, detailed reviews and guides. We have everything about the Linux operating system

Источник

Как пользоваться GitHub на компьютере с Linux

Обновлено и опубликовано

Опубликовано: 15.03.2019

GitHub — один из используемых сервисов размещения проектов для совместной разработки. Он поддерживает контроль версий, возможность отслеживания изменений кода, сравнение строк, а также он бесплатен.

В данной статье приведены примеры использования сервиса на компьютере под управлением операционных систем семейства Linux. Мы рассмотрим, как создать проект на локальном компьютере и залить его на сервис с помощью командной строки. Рассмотренные варианты использования git также можно применять на desktop системах, запустив окно терминала.

Установка git

Управление выполняется с помощью приложения git. Если его нет в системе, установку можно выполнить из репозитория.

Если используем CentOS / Red Hat:

Если используем Ubuntu / Debian:

Если мы хотим воспользоваться сервисом с компьютера Windows или Mac OS, необходимо скачать и установить desktop версию с официального сайта.

Синтаксис

Команды имеют следующий синтаксис:

* полный перечень опций, команд и аргументов можно получить командой man git.

Создание проекта на локальном компьютере

Прежде чем отправить проект на GitHub, создаем его на нашем компьютере. Для этого переходим в каталог с файлами проекта:

Инициализируем проект для git:

Мы получим ответ похожий на:

Initialized empty Git repository in /projects/.git/

Это означает, что репозиторий git создан.

Теперь добавим файлы в репозиторий:

* данной командой мы добавили папку и ее содержимое в репозиторий git.

Отправка данных на GitHub

Теперь можно отправить данные на сервис. Для этого у нас должна быть зарегистрированная учетная запись и создан репозиторий на GitHub.

Создание репозитория

Переходим на портал github.com и входим в систему или проходим несложную регистрацию:

Регистрация на GitHub

Проходим процесс подтверждения, что мы не робот. Затем завершаем несколько шагов регистрации, нажимая Submit. В итоге мы получим письмо на адрес электронной почты, которую указали при регистрации. Необходимо будем подтвердить email, перейдя в письме по кнопке Verify email address.

Создаем репозиторий. Для этого кликаем по иконке профиля и переходим в раздел Your repositories:

Переход к созданию нового репозитория на GitHub

И кликаем по кнопке New. В следующем окне даем название репозиторию и нажимаем Create repository:

Создаем репозиторий на GitHub

Мы увидим страницу с путем к репозиторию:

Путь к репозиторию, который создали на GitHub

Заливаем проект в репозиторий на GitHub

Добавляем комментарий к нашему проекту:

git commit -m «Очередное изменение проекта» -a

* где Очередное изменение проекта — произвольный комментарий; параметр -a указывает, что комментарий нужно применить ко всем измененным файлам.

Теперь подключаемся к созданному репозиторию:

git remote add origin https://github.com/dmosktest/project1.git

* где dmosktest — логин, который был указан при регистрации на github, а project1 — название, которое мы задали, когда создавали репозиторий.
* удалить удаленный репозиторий можно командой git remote rm origin.

Закидываем проект на GitHub:

* где master — ветка проекта (веток может быть несколько).

В нашем проекте на GitHub должны появиться файлы проекта:

Загруженный проект на GitHub

Получение файлов с GitHub

Для загрузки на компьютер файлов, создаем каталог с проектом и переходим в него:

Проводим начальную настройку локального репозитория:

Подключаемся к удаленному репозиторию:

git remote add origin https://github.com/dmosktest/project1.git

Скачиваем проект командой:

git pull https://github.com/dmosktest/project1.git master

Клонирование проекта

Например, использую наш репозиторий:

git clone https://github.com/dmosktest/project1.git

* данная команда создаст в текущей папке каталог project1 и инициализирует его как локальный репозиторий git. Также загрузит файлы проекта.

Возможные ошибки

1. При попытке отправить данные на GitHub, получаем ошибку:

error: src refspec master does not match any.
error: failed to push some refs to ‘https://github.com/dmosktest/project1.git’

* где dmosktest/project1.git — путь к нашему репозиторию.

Причина: проект ни разу не был зафиксирован (закоммичен).

Решение: добавляем комментарий к нашему проекту:

git commit -m «first commit»

Источник

Читайте также:  Создание символьной ссылки линукс
Оцените статью
Adblock
detector