![]() ![]() This can be done with the following commands: $ git remote set-url $ git remote set-url -push This means you can actually set two different remote repositories for "origin", one for the push operation and one for fetch. In the output of the last command you may have noticed that there are actually two lines listed for the "origin" remote repository. Once you've added a remote to your repo you can then verify it with the -v flag: $ git remote -v You can also set these remotes as your default push or pull locations, shortening your Git commands even more.įor example, to add a remote origin to your repository, you would use the command like this: $ git remote add origin :scottwrobinson/camo.git The remote name is helpful for being able to reference this repository without having to type out the entire location. The command you'll want to use is git remote add, and is generally used in the following way: $ git remote add In this short article I'll explain exactly how to do that. Either way, it's beneficial to associate a remote repository to your local one. Or you may just want to have a way to link your local Git repo with the remote one on GitHub. This is beneficial for when you want to pull in updates from someone else's fork of a project, for example. Note that if you're not going to allow write access to the group, make sure to first use chown to set the owner of the repo, and then run the git init command as that user (to make sure the repo is initialized with the correct owner for all the initial files and sub-directories).In the Git version control system you're able to push and pull code from any number of remote repositories. This allows read and write access to the user and group, and read-only access to other: git init -bare -shared=0664 /srv/git/myrepo.git This allows read and write access to the user and group (and no access to other): git init -bare -shared=0660 /srv/git/myrepo.git For example, this allows read and write access to the user, and read-only access to the group (and no access to other): git init -bare -shared=0640 /srv/git/myrepo.git If you want to fine-tune the user, group, or other users' permissions, use -shared=0NNN, where NNN are the standard user, group, and other bits for files (the execute and sgid bits on directories will be managed appropriately by git). nyNonFastforwards = 1: deny non fast-forward pushes to the repo.core.sharedrepository = 1 (same as core.sharedrepository = group): the repo directory and all directories later created in it will be managed by git to allow mygroup read, write, and execute permissions (with the sgid bit set as well - so as to work with users for whom mygroup is not their primary group).the third line initializes a bare repo with the following configuration:.the second line sets its group to mygroup. ![]() Git init -bare -shared /srv/git/myrepo.git If you're setting up a brand new repo myrepo in /srv/git for the group mygroup, this is what you want: mkdir /srv/git/myrepo.git ![]() To aggregate the bits and pieces of good advice from the various other answers and comments about setting up a new repo: This sets up the extended ACL for the group so that the group members can read/write/access whatever files are already there (the first line) then, also tell all existing directories that new files should have this same ACL applied (the second line). So once again, create your group, then run: setfacl -R -m g::rwX gitrepoįind gitrepo -type d | xargs setfacl -R -m d:g::rwX ![]() But basically, an extended ACL is the ability to set permissions on more than just the 3 default slots (user/group/other). I’ve only come to this area fairly recently, so my knowledge here isn’t as hot as it could be. The New-Wave SolutionĪ superior solution-though less well understood, and which requires a bit more OS/tool support-is to use POSIX extended attributes. And sooner or later, something is going to screw up your carefully crafted permissions scheme, putting the repo out of action until you get root access and fix it up (i.e., re-running the above commands). The problems with this are legion if you’re on a distro that assumes a umask of 022 (such as having a common users group that includes everyone by default), this can open up security problems elsewhere. Then change the umask for the users to 002, so that new files get created with group-writable permissions. If you put all the developers in a specially-created group, you can, in principle, just do: chgrp -R gitrepo Skip down to The New-Wave Solution for the superior method of granting a group of developers write capability. Basically, you need to make sure that all of those developers can write to everything in the git repo. ![]()
0 Comments
Leave a Reply. |