1

I'm new to Git and I am trying to understand the concept. Maybe someone can help me with a few theoretical questions?

So there is a Git on the remote server and a cloned git on my local computer.

After cloning the git to my local computer with a read permission (gitolite with 'R' permission), can I do any damage to the git on the remote server?

If I do a 'git reset --hard' (I know that there is often a strong advise against it), does this only reset the changes on my local computer or also on the remote server?
Is there a difference if I work with R or RW+ authorization?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
eliot
  • 21
  • 3

1 Answers1

5

First, Git itself has no notion of 'R' or 'RW+': those are read-write permission managed by gitolite, an authorization layer called through SSH (forced command: the ~git/.ssh/Authorized_keys file calls the gitolite script) or HTTPS.

git reset --hard is purely a local function, which does involve:

  • Git only, not gitolite
  • your local repository only, not the remote repository behind Gitolite.

If you were to reset HEAD to a different commit, the only way to push that new HEAD would be through the Git operation git push --force.

That is where Gitolite comes, with the permission field of the access rules included in the (remote) gitolite-admin repository.

Only an access rule including RW+ would allow you to push --force.
R is only for cloning and fetching, it prevents pushing (force or not).

Levi Haskell
  • 795
  • 8
  • 20
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250