Difference between revisions of "Git"

From Fixme.ch
Jump to: navigation, search
(Redirected page to Gitolite)
(Info)
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
#REDIRECT [[Gitolite]]
+
{{warning|Documentation in progress. Send your angry messages to [[User:dgellow]] if you think it can make you feel better.}}
 +
 
 +
= Migration from gitolite to Gogs =
 +
 
 +
Authors: [[User:dgellow]], [[User:nemen]]
 +
 
 +
Date: July 2015
 +
 
 +
== Reasons ==
 +
< list of irrefutable arguments >
 +
 
 +
== Info ==
 +
 
 +
* Trello card: https://trello.com/c/NSQnA7gV
 +
* New base git URL: <code>ssh://gogs@git.fixme.ch:1337/<user>/<repo></code> where <code><user></code> can be a username or an organization
 +
 
 +
= Git 101 =
 +
 
 +
< some discussions around basic commands >
 +
 
 +
= Mirror a repo from foo.fixme.ch to somewhere else (github in this example) =
 +
 
 +
* Create the target repository (for github, create a new repo)
 +
 
 +
* Set a new push remote
 +
<pre>
 +
# ssh to foo
 +
ssh YOUR_USER@foo.fixme.ch -p 1337
 +
# Navigate to the repository
 +
cd /home/gogs/gogs-repositories/YOUR_USER/YOU_REPO.git
 +
# Switch to the gogs user
 +
su gogs
 +
# Add a push remote (Don't forget the `--mirror=push` !)
 +
git remote add --mirror=push origin git@github.com:GITHUB_USER/YOUR_REPO.git
 +
# Test it
 +
git push --mirror
 +
</pre>
 +
 
 +
You will certainly need to register a Deploy Key in your github project. See https://developer.github.com/guides/managing-deploy-keys/#deploy-keys
 +
 
 +
* Check that a `post-receive` git hook is defined for you repository on git.fixme.ch
 +
You can access it here :
 +
https://git.fixme.ch/YOUR_USER/YOUR_REPO/settings/hooks/git/post-receive
 +
The content should be something like that:
 +
<pre>
 +
git push --mirror
 +
</pre>
 +
 
 +
* That's it. You can try with a simple commit and push.
 +
<pre>
 +
# In your local clone
 +
touch test_mirror
 +
git add test_mirror
 +
git commit -m "test push to mirror"
 +
git push
 +
</pre>
 +
 
 +
= Gogs =
 +
 
 +
< description and a small guide >
 +
 
 +
== Organizations ==
 +
 
 +
== Hooks ==
 +
 
 +
=== Web hooks ===
 +
 
 +
=== Git hooks ===

Latest revision as of 01:55, 30 July 2015

Warning Warning: Documentation in progress. Send your angry messages to User:dgellow if you think it can make you feel better.


Migration from gitolite to Gogs

Authors: User:dgellow, User:nemen

Date: July 2015

Reasons

< list of irrefutable arguments >

Info

Git 101

< some discussions around basic commands >

Mirror a repo from foo.fixme.ch to somewhere else (github in this example)

  • Create the target repository (for github, create a new repo)
  • Set a new push remote
# ssh to foo
ssh YOUR_USER@foo.fixme.ch -p 1337
# Navigate to the repository
cd /home/gogs/gogs-repositories/YOUR_USER/YOU_REPO.git
# Switch to the gogs user
su gogs
# Add a push remote (Don't forget the `--mirror=push` !)
git remote add --mirror=push origin git@github.com:GITHUB_USER/YOUR_REPO.git
# Test it
git push --mirror

You will certainly need to register a Deploy Key in your github project. See https://developer.github.com/guides/managing-deploy-keys/#deploy-keys

  • Check that a `post-receive` git hook is defined for you repository on git.fixme.ch

You can access it here : https://git.fixme.ch/YOUR_USER/YOUR_REPO/settings/hooks/git/post-receive The content should be something like that:

git push --mirror
  • That's it. You can try with a simple commit and push.
# In your local clone
touch test_mirror
git add test_mirror
git commit -m "test push to mirror"
git push

Gogs

< description and a small guide >

Organizations

Hooks

Web hooks

Git hooks