Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:howto:git [2009/08/14 00:40] – add info about push.default kelnosdev:howto:git [2017/06/12 12:58] (current) skunnyk
Line 1: Line 1:
 ====== Xfce.org Git Infrastructure ====== ====== Xfce.org Git Infrastructure ======
  
-**All Xfce SVN repos have been converted to git.**+**This documentation is obsolete ! Please see http://docs.xfce.org/contribute/dev/start** 
 + 
  
 ===== Account Setup ===== ===== Account Setup =====
  
-If you have an xfce.org Subversion account that does **not** include ssh access (that is, you check in using https), you will need to apply to get your account converted [[https://foo-projects.org/node/3|here]].  Fill out the form with the same info you used previously, but remember to include a ssh public key in the appropriate box. Translators: [[dev:howto:git#translator_access|see here]].+If you have an xfce.org Subversion account that does **not** include ssh access (that is, you check in using https), you will need to apply to get your account converted [[https://releases.xfce.org/login/request|here]].  Fill out the form with the same info you used previously, but remember to include a ssh public key in the appropriate box. Translators: [[dev:howto:git#translator_access|see here]].
  
 If you used the "old" git.xfce.org, and used clone/push URLs like "''git@git.xfce.org:$USER/$MODULE''", then you should follow the directions above as well. If you used the "old" git.xfce.org, and used clone/push URLs like "''git@git.xfce.org:$USER/$MODULE''", then you should follow the directions above as well.
Line 13: Line 15:
 If you already have a ssh shell account on git.xfce.org (aka mocha.xfce.org), your account information has not been changed and you are ready to go. If you already have a ssh shell account on git.xfce.org (aka mocha.xfce.org), your account information has not been changed and you are ready to go.
  
-If you do not have an xfce.org account at all, you'll need to request one using [[https://foo-projects.org/node/3|the usual process]].+If you do not have an xfce.org account at all, you'll need to request one as explained on [[/contribute#getting_a_git_account|that page]].
  
 ===== Usage ===== ===== Usage =====
Line 19: Line 21:
 **If you are uncertain of the clone URL to use for a particular module, please find and click on the module in the listing in [[http://git.xfce.org/|CGit]].  Clone URLs are listed at the bottom of the page for each module.** **If you are uncertain of the clone URL to use for a particular module, please find and click on the module in the listing in [[http://git.xfce.org/|CGit]].  Clone URLs are listed at the bottom of the page for each module.**
  
-To pull from $MODULE in $TYPE you'd use this command (where TYPE is 'apps', 'bindings', 'xfce', etc): +In short:  If you don't have a ssh account and just want read-only copy of the source, you'll want to do:
- +
-<code>git clone ssh://$USERNAME@git.xfce.org/git/$TYPE/$MODULE</code> +
- +
-This will automatically set up the 'origin' remote in the cloned repository to point to that location, so "git push" will do the right thing.  If your local username is the same as your git.xfce.org ssh username, you can omit the ''$USERNAME@'' portion of the URL. +
- +
-Unfortunately, we cannot support https pushes at this time due to limitations in the Git http protocol support. +
- +
-Read-only clones can be obtained via:+
  
 <code>git clone git://git.xfce.org/$TYPE/$MODULE</code> <code>git clone git://git.xfce.org/$TYPE/$MODULE</code>
Line 33: Line 27:
 or or
  
-<code>git clone http://git.xfce.org/git/$TYPE/$MODULE</code>+<code>git clone http://git.xfce.org/$TYPE/$MODULE</code>
  
-Viewing of the repository in a web browser is provided by a CGit instance at http://git.xfce.org/.+''$TYPE'' is one of 'apps', 'bindings', 'xfce', etc.  See the italicized group names in the [[http://git.xfce.org/|CGit index]].
  
-===== Translator Access =====+Committers, see below.
  
-Translators will be using [[https://translations.xfce.org/|our Transifex install]] to submit translation updates.  Direct access to the git repository will no longer be provided.  **NOTE: This is not set up yet.  Existing translators will receive an email when their Transifex account is ready.**+===== Committers =====
  
-===== Account Maintenance =====+Before you even think about pushing changes, you must set your name and email address to something valid in your **local** Git config:
  
-To change or set your password, run:+<code>git config --global user.name "J. Random Hacker" 
 +git config --global user.email jrandom@example.com</code>
  
-<code>ssh -t $USERNAME@git.xfce.org passwd</code>+**Also**, you must subscribe this address to the [[http://mail.xfce.org/mailman/listinfo/xfce4-commits|xfce4-commits]] mailing list.  If you don'wish to receive mail from this list, you can disable mail delivery If you do not subscribe, commit notifications will not go to the list.  We're working on a way to remove this requirement, but for now you will need to be subscribed. At the moment, committing with an @xfce.org email doesn't put that requirement thus you can run the command above without the ''%%--global%%'' option in your individual Xfce projects.
  
-(The ''-t'' option makes it so your password won't get echoed to the terminal as you type it; if you don't carefeel free to leave it out.)+If you have a ssh accountyou can clone a repository with:
  
-To list your active ssh keys, run:+<code>git clone ssh://git@git.xfce.org/$TYPE/$MODULE</code>
  
-<code>ssh $USERNAME@git.xfce.org ssh-key-admin list-keys</code>+This will automatically set up the 'origin' remote in the cloned repository to point to that location, so a "git push" will do the right thing. You can also clone through a regular ''git:'' url and add the following snippet to ''.git/config''
 +<code> 
 +[url "ssh://git@git.xfce.org"] 
 +        pushInsteadOf = "git://git.xfce.org" 
 +</code>
  
-To add a ssh keyrun:+Unfortunatelywe cannot support https pushes at this time due to limitations in the Git http protocol support.  If you are unable to communicate with git.xfce.org on port 22, ''git push'' will not work for you.
  
-<code>ssh $USERNAME@git.xfce.org ssh-key-admin add-key "ssh-rsa kjlsdkf... me@example.com"</code>+===== Translator Access =====
  
-Be sure to remember the quotes around the key data itself.  Paste the entire contents of your ''.pub'' file (usually ''$HOME/.ssh/id_rsa.pub'' or ''$HOME/.ssh/id_dsa.pub'').+Translators should use [[https://translations.xfce.org/|our Transifex install]] to submit translation updates Direct access to the git repository is no longer provided.
  
-To remove a ssh keyrun:+If you do not have an accountregister for one at our Transifex site and inquire on [[xfce-i18n@xfce.org]] about commit access.  See our [[:translations]] page for more information.
  
-<code>ssh $USERNAME@git.xfce.org ssh-key-admin del-key me@example.com</code>+===== Account Maintenance =====
  
-You'll need to use the "key comment" when removing keys, which is the last section of the key data in the key file (everything from the last space to the end of the line) You can use the ''list-keys'' command above to get a list.+To change your password and manage your active ssh keys, you should login to the [[https://releases.xfce.org/|release manager]] and go to the profile page.
  
 ===== New Repositories ===== ===== New Repositories =====
  
-For 'Goodies' developers, we used to have an "open repository creation" policy in our Subversion repo in which any user with write access could create a new module for a new project.  With the move to Git, this is no longer possible.  You will need to request the creation of a new Git repo by emailing [[xfce-repo-admin@xfce.org]] to request a new module.  Please include the module name, which category it should be under (apps, art, bindings, libs, panel-plugins, or thunar-plugins), a description of the module, and a rationale as to why it should be hosted on git.xfce.org (instead of github, gitorious, etc.).  Note that requests to be added to the 'admin,' 'archive,' or 'xfce' categories will be denied.+For 'Goodies' developers, we used to have an "open repository creation" policy in our Subversion repo in which any user with write access could create a new module for a new project.  With the move to Git, this is no longer possible.  You will need to request the creation of a new Git repo by emailing [[xfce-repo-admin@xfce.org]] to request a new module.  Please include your git.xfce.org ssh username, the module name, which category it should be under (apps, art, bindings, libs, panel-plugins, or thunar-plugins), a description of the module, and a rationale as to why it should be hosted on git.xfce.org (instead of github, gitorious, etc.).  Note that requests to be added to the 'admin,' 'archive,' or 'xfce' categories will be denied.
  
 ===== Policies ===== ===== Policies =====
Line 89: Line 88:
 ===== Commit Notifications ===== ===== Commit Notifications =====
  
-We are doing away with the goodies-commits email list.  All commit mails in all git repositories will go to the [[http://foo-projects.org/mailman/listinfo/xfce4-commits|xfce4-commits list]].  The subject lines of the emails should be pretty easy to filter on if you only want a subset of emails.  We generate one commit mail per commit object (and for some other things too), so if you push a large number of commits, you'll generate a large number of emails.+We are doing away with the goodies-commits email list.  All commit mails in all git repositories will go to the [[http://mail.xfce.org/mailman/listinfo/xfce4-commits|xfce4-commits list]].  The subject lines of the emails should be pretty easy to filter on if you only want a subset of emails.  We generate one commit mail per commit object (and for some other things too), so if you push a large number of commits, you'll generate a large number of emails.
  
 ===== Tips and Tricks ===== ===== Tips and Tricks =====
  
-==== Shortcut URLS ==== +See [[dev:howto:git-tips-and-tricks]].
- +
-If you clone a lot of Xfce repositories, you can set a shortcut so you don't have to type out the full URL all the time.  Simply run: +
- +
-<code>git config --global 'url.ssh://git.xfce.org/git/.insteadOf' xfce:</code> +
- +
-After this, you'll be able to do, for example: +
- +
-<code>git clone xfce:xfce/xfdesktop</code> +
- +
-and Git will automatically rewrite it to the correct URL.  You can of course do this with git: and http: URLs as well. +
- +
-==== Different Local Username? ==== +
- +
-If your ssh username is not the same as your local username, you can make an entry in ''$HOME/.ssh/config'' (create it if it doesn't exist) so you don't have to type it each time: +
- +
-<code>Host git.xfce.org +
-    User $USERNAME</code> +
- +
-Of course, replace ''$USERNAME'' with your actual username. +
- +
-==== Branch Auto-pushing ==== +
- +
-If you have a relatively new version of Git on your machine, you may get this message after running ''git push'': +
- +
-<code>warning: You did not specify any refspecs to push, and the current remote +
-warning: has not configured any push refspecs. The default action in this +
-warning: case is to push all matching refspecs, that is, all branches +
-warning: that exist both locally and remotely will be updated.  This may +
-warning: not necessarily be what you want to happen. +
-warning: +
-warning: You can specify what action you want to take in this case, and +
-warning: avoid seeing this message again, by configuring 'push.default' to: +
-warning:   'nothing'  : Do not push anything +
-warning:   'matching' : Push all matching branches (default) +
-warning:   'tracking' : Push the current branch to whatever it is tracking +
-warning:   'current'  : Push the current branch</code> +
- +
-This warning is harmless, but you might want to change the value both to make your pushes "safer" and to get rid of the warning.  Personally, I set mine to "tracking": +
- +
-<code>git config --global push.default tracking</code> +
- +
-My rationale here is: +
-  - Using 'nothing' is annoying: you have to specify the full name to push each time (e.g. ''git push origin master''). +
-  - Using 'current' could result in you accidentally pushing a new branch (that is, one that doesn't exist on the server) by accident. +
-  - Using 'matching' will push **all** local branches that exist on the server.  If you had some commits in another local tracking branch that you forgot about but didn't want to push yet, these will get pushed anyway. +
-  - Using 'tracking' will only push the current branch, and then only if the branch already exists on the server Yes, this means if you want to push multiple branches you have to push several times, but how often do you need to do that?  It also means that if you're pushing a new branch, you have to explicitly name the branch on the command line the first time you push it, but, again, how often do you do that?+
  
 ===== Migrating From git-svn Clones ===== ===== Migrating From git-svn Clones =====
Line 154: Line 107:
 $ git checkout master $ git checkout master
 $ git checkout -b new-drawing $ git checkout -b new-drawing
-$ git pull ../xfdesktop.git-svn new-drawing:refs/heads/tmpbranch +$ git fetch ../xfdesktop.git-svn new-drawing:refs/heads/tmpbranch
-$ git reset --hard new-drawing+
 $ git log tmpbranch</code> $ git log tmpbranch</code>
  
Line 169: Line 121:
 <code>$ git cherry-pick d1e0179e8b6f00e4f452513c100f674f7d35dc11 <code>$ git cherry-pick d1e0179e8b6f00e4f452513c100f674f7d35dc11
 $ git cherry-pick e3633d52774bd9a2a20ef9af37d3f72f964a2f54</code> $ git cherry-pick e3633d52774bd9a2a20ef9af37d3f72f964a2f54</code>
 +
 +(Note: if there's only one commit to merge, you can skip the above and just do ''git cherry-pick tmpbranch'', which will just cherry pick the ''HEAD'' commit of ''tmpbranch''.)
  
 Now, if I got any merge errors after one of the cherry pick commands, I'd have to stop there and fix it up first: Now, if I got any merge errors after one of the cherry pick commands, I'd have to stop there and fix it up first:
Line 187: Line 141:
  
 You'll have to repeat this process for any other local branch you have in the old git-svn clone.  As I said, yes, it's annoying, repetitive, manual, and time-consuming (if you have a lot of branches/clones to convert).  If anyone knows a better way, feel free to detail it here. You'll have to repeat this process for any other local branch you have in the old git-svn clone.  As I said, yes, it's annoying, repetitive, manual, and time-consuming (if you have a lot of branches/clones to convert).  If anyone knows a better way, feel free to detail it here.
 +
 +After you finish with all branches in a particular module, you may want to run:
 +
 +<code>$ git gc --prune=now</code>
 +
 +This will remove all the dangling commits, trees, and blobs left over from the probably-large number of mismatched objects discarded when you deleted tmpbranch.