0

I am working on a project with my colleague inside our company in Ubuntu. He has created a git repository for our project locally on a shared server to which both of us have access. And we do not intend to put it on Github.com

I have cloned that project, but I could not find a way how my colleague can give me "contributor permission" to pull to this local git repository and how he can review my changes in order to merge to master branch.

I have searched in the net and found only solution of putting the website in Github.com and giving contributor permission in the website.

I have seen some people say we should use "git init --shared={all|world|everybody}", but still the question remains, how I can push to that repository and he can review my changes before merging. Shall I just simply run "git push -u origin master"?

My colleague has reinitialized the repository with "git init --shared=0777". However, when I try to push to this repository after "git add . " and "git commit -m "STH EDITED" " I receive the following error:

majid@majid:~/Projects/Annotation$ git push -u /data/sstore-data/projects/AnnotateTool
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.45 KiB | 0 bytes/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: error: insufficient permission for adding an object to repository database ./objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To /data/sstore-data/projects/AnnotateTool
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '/data/sstore-data/projects/AnnotateTool'
10
  • 1
    Your colleague should have created the repo with the shared flag.
    – PerlDuck
    Commented Feb 7, 2018 at 9:56
  • By "locally" do you mean some intranet server? Or are you two working on the same system?
    – muru
    Commented Feb 7, 2018 at 9:59
  • 1
    You push to a new branch, then he can diff the branches, or merge interactively.
    – muru
    Commented Feb 7, 2018 at 10:29
  • 1
    Then you should use a different workflow: He should fetch from your repo, review the code, and then merge your code in his branch in his repo.
    – PerlDuck
    Commented Feb 7, 2018 at 10:29
  • 1
    Exactly. Git even has a command for this: the git request-pull. It depends on your team whether that's really necessary or if it's sufficient to just ring up your colleagues.
    – PerlDuck
    Commented Feb 7, 2018 at 12:39

1 Answer 1

0

after using for a while here is the solution based on @PerlDuck comments (Thanks!) the combination of following commands allows to share a git repository on server with colleagues or other group mates.

git init --shared={all|world|everybody} git request-pull

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .