Development using git:Cgit: Difference between revisions

From Alpine Linux
(Created page with "Developers with SSH access can publish their repositories on cgit at [http://git.alpinelinux.org/ git.alpinelinux.org]. == Create a repository == Create a directory on ...")
 
No edit summary
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Merge|Development using git:Developer repositories|It's not easy at a glance to sort out what's (i) general info about using cgit (for any project), and what's (ii) specific to coordinating with the Alpine developer repositories. Might we either merge these pages, or segregate the information into (i) and (ii)?}}
{{Merge|Git|All basic {{Pkg|cgit}} info should be pulled and merged. All Alpine development info should be moved elsewhere}}
Developers with SSH access can publish their repositories on [[Cgit|cgit]] at [http://git.alpinelinux.org/ git.alpinelinux.org].
Developers with SSH access can publish their repositories on [[Cgit|cgit]] at [http://git.alpinelinux.org/ git.alpinelinux.org].


== Create a repository ==
== Create a repository ==
Create a directory on your local computer or somewhere you have access.
Create a directory on your local computer or somewhere you have access. If you already have an existing git repository, skip this section.


{{cmd|mkdir mytest
{{cmd|mkdir myrepo
cd mytest}}
cd myrepo}}
init git and create a first commit
init git and create a first commit
{{cmd|echo "testing" > test.txt
{{cmd|echo "testing" > test.txt
Line 14: Line 19:
== Create a bare repo ==
== Create a bare repo ==
Clone it to a bare repo
Clone it to a bare repo
{{cmd|cd ..
{{cmd|cd ..
git clone --bare mytest mytest.git}}
git clone --bare myrepo myrepo.git}}


Set the description
Set the description
{{cmd|echo "My git/cgit test" > mytest.git/description}}
{{cmd|echo "My git/cgit test repo" > myrepo.git/description}}


== Publish it on git.alpinelinux.org ==
Set the section and your name for cgit.  
Set the section and your name for cgit.  


{{cmd|<nowiki>cat <<EOF >> mytest.git/cgitrc
{{cmd|<nowiki>cat <<EOF >> myrepo.git/cgitrc
> section=Developer Your_alias
> section=Developer Your_alias
> owner=Your_full_name
> owner=Your_full_name
> EOF</nowiki>}}
> EOF</nowiki>}}


Copy the content to the directory ~/cgit on [http://git.alpinelinux.org/ git.alpinelinux.org]
{{Note|The 'description' file and 'cgitrc' file are needed to make cgit publish information about your repo.}}
{{cmd|scp -r mytest.git git.alpinelinux.org:cgit/}}


== Clean up ==
== Upload to git.alpinelinux.org ==
We no longer need the local bare repository.
 
{{cmd|rm -rf mytest.git}}
Copy the content to your the ~/cgit directory on [http://git.alpinelinux.org/ git.alpinelinux.org].


== Add upstream source to merge with ==
{{cmd|scp -r myrepo.git git.alpinelinux.org:cgit/}}
If the project you uploaded is a clone of an existing repository (aports for example), add the original source as a git remote repository ("upstream" can be whatever name you want to assign to the remote repository):


{{cmd|git remote add upstream git://git.alpinelinux.org/aports}}
== Clean up ==
We no longer need the local aports.git directory.
{{cmd|rm -rf myrepo.git}}


Then, to synchronize your local copy with upstream then push your changes (might need to fix merge conflicts if/when they happen):
== Last step ==
Now ping <tt>ncopa</tt> or somebody else on IRC in [[IRC|#alpine-devel]] with the corresponding permissions to create symlinks on [http://git.alpinelinux.org/ git.alpinelinux.org] and your repository will show up. Once the symlink is created all further repositories will be published on [http://git.alpinelinux.org/ git.alpinelinux.org].


{{cmd|git pull upstream master
git push}}


== Add your personal repository ==


So far git does not know anything about about your repositories.


== Git Push (Distributed Workflows) ==
{{Cmd|cd myrepo
If working with [http://book.git-scm.com/3_distributed_workflows.html Distributed Workflows] you would 'pull' from public repo, 'push' to another publically accessable repo ''(where you have write access)'', main developer ''(who has write access to public repo)'' 'pulls' you changes from your pub.accessed.repo into the public repo.  
git remote add origin ssh://git.alpinelinux.org/gitroot/username/myrepo.git}}


To make it easier for you to work, you can configure 'git push' to push your work to your publically accessable repo ''('git pull' would still pull from same repo as you cloned from)''.
== Add upstream source to merge with ==
{{cmd|cd /your/private/repo/where/you/work/reponame
If the project you uploaded is a clone of an existing repository (aports for example), add the original source as a git remote repository ("upstream" can be whatever name you want to assign to the remote repository):
git config remote.origin.pushurl "ssh://user@dev.alpinelinux/home/user/cgit/reponame.git"}}


Now 'git pull' pulls the public repo, and 'git push' pushes to '''your''' public repo.
{{Cmd|git remote add upstream git://git.alpinelinux.org/aports}}


{{Note|The path where you want to push to should first be prepared as described in above section 'Create a bare repo' and 'Publish it on git.alpinelinux.org'}}
Then, to synchronize your local copy with upstream then push your changes (might need to fix merge conflicts if/when they happen):


Moved from another article
{{cmd|git pull upstream master
git push}}


=== Upload the new project ===
== The quick way ==
{{Cmd|<nowiki>cd ..
{{Cmd|<nowiki>cd ..
git clone --bare acf-mystuff acf-mystuff.git
git clone --bare acf-mystuff acf-mystuff.git
Line 67: Line 73:
scp -r acf-mystuff.git user@dev.alpinelinux.org:cgit/</nowiki>}}
scp -r acf-mystuff.git user@dev.alpinelinux.org:cgit/</nowiki>}}


{{Note|The 'description' and 'cgitrc' are needed to make cgit publish information about your repo}}
[[Category:Development]]
 
[[Category:Git]]
More details found when reading [[Publish developer repositories on cgit]].

Revision as of 19:29, 9 December 2018

This material is proposed for merging ...

It should be merged with Development using git:Developer repositories. It's not easy at a glance to sort out what's (i) general info about using cgit (for any project), and what's (ii) specific to coordinating with the Alpine developer repositories. Might we either merge these pages, or segregate the information into (i) and (ii)? (Discuss)

This material is proposed for merging ...

It should be merged with Git. All basic cgit info should be pulled and merged. All Alpine development info should be moved elsewhere (Discuss)


Developers with SSH access can publish their repositories on cgit at git.alpinelinux.org.

Create a repository

Create a directory on your local computer or somewhere you have access. If you already have an existing git repository, skip this section.

mkdir myrepo cd myrepo

init git and create a first commit

echo "testing" > test.txt git init git add . git commit -m 'initial commit'

Create a bare repo

Clone it to a bare repo

cd .. git clone --bare myrepo myrepo.git

Set the description

echo "My git/cgit test repo" > myrepo.git/description

Set the section and your name for cgit.

cat <<EOF >> myrepo.git/cgitrc > section=Developer Your_alias > owner=Your_full_name > EOF

Note: The 'description' file and 'cgitrc' file are needed to make cgit publish information about your repo.

Upload to git.alpinelinux.org

Copy the content to your the ~/cgit directory on git.alpinelinux.org.

scp -r myrepo.git git.alpinelinux.org:cgit/

Clean up

We no longer need the local aports.git directory.

rm -rf myrepo.git

Last step

Now ping ncopa or somebody else on IRC in #alpine-devel with the corresponding permissions to create symlinks on git.alpinelinux.org and your repository will show up. Once the symlink is created all further repositories will be published on git.alpinelinux.org.


Add your personal repository

So far git does not know anything about about your repositories.

cd myrepo git remote add origin ssh://git.alpinelinux.org/gitroot/username/myrepo.git

Add upstream source to merge with

If the project you uploaded is a clone of an existing repository (aports for example), add the original source as a git remote repository ("upstream" can be whatever name you want to assign to the remote repository):

git remote add upstream git://git.alpinelinux.org/aports

Then, to synchronize your local copy with upstream then push your changes (might need to fix merge conflicts if/when they happen):

git pull upstream master git push

The quick way

cd .. git clone --bare acf-mystuff acf-mystuff.git echo "My acf-mystuff repo" > acf-mystuff.git/description echo "section=Developer user" > acf-mystuff.git/cgitrc scp -r acf-mystuff.git user@dev.alpinelinux.org:cgit/