http_push.rst 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. HTTP PUSH
  2. =========
  3. When using git push over http against a pagure instance, there are two
  4. situations to distinguish.
  5. Git push over http with API token
  6. ---------------------------------
  7. This is going to be the most supported approach. Any user can generate API
  8. tokens with the ``commit`` ACL which reads in the UI as: `Commit to a git
  9. repository via http(s)`.
  10. These API tokens can be specific to a project if generated in the settings
  11. page of the project, or generic to all projects if generated in the
  12. user's settings page.
  13. In either case, they will no work if the user does not have at commit access
  14. to the project.
  15. Once the API token has been generate, the user needs to enter it with git
  16. prompts for a password (instead of their actual password).
  17. For example:
  18. ::
  19. $ git push
  20. username: pingou
  21. password: ABC123...
  22. Git push over http with Username & Password
  23. -------------------------------------------
  24. This is only supported on pagure instance that are using the ``local``
  25. authentication system (ie: where pagure manages the registration of the
  26. user accounts, email confirmation, etc).
  27. For these pagure instances and for these only, when being prompted by git
  28. for an username and password the user can choose to enter either their
  29. username and actual password or their username and an API token.
  30. Storing the password/token
  31. --------------------------
  32. If you interact with git regularly, typing you password or API token will
  33. quickly become tiring.
  34. Thanksfully, git has a built-in mechanism named `git credential store
  35. <https://git-scm.com/docs/git-credential-store>`_ which can take care of this
  36. for you.
  37. You can use two modes for the store, either ``cache`` or ``store``.
  38. - `cache` will cache your credential in memory for 15 minutes (by default)
  39. - `store` will actually store your credentials in **plain text** on disk
  40. You can set this using either:
  41. ::
  42. $ git config credential.helper store
  43. $ git config credential.helper cache
  44. The timeout of the cache can be configured using:
  45. ::
  46. $ git config credential.helper 'cache --timeout=3600'
  47. Where the timeout value is a number of seconds (so here the cache is extended
  48. to one hour).
  49. Finally, if you wish to use this configuration on multiple project, you can
  50. add the ``--global`` argument to these commands which will make the
  51. configuration work for all your git repo instead of just the one in which
  52. you run the command.