You have two Linux servers (server A and server B). You have a Git repository on server A. You are logged into server B as jdoe. You cloned a Git repository from server A (with a "git clone git@gitlabFQDN:/path/to/nameOfRepo.git" command). You added some files and used "git commit" on server B. From server B you run this command as the Linux user jdoe: git push origin master
You get this problem:
remote: GitLab: You are not allowed to upload code for this project.
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@GitLabServerFQDN:/var/opt/gitlab/git-data/repositories/root/nameOfRepo.git'
How do you upload the new files?
1. Log into the web UI for GitLab.
2. Click on the Project that has the repository you want.
3. On the left click on "Settings".
4. Click on "Repository" under "Settings."
5. Click on the "Expand" button for "Deploy Keys".
6. Provide an arbitrary phrase in the "Title" field.
7. For the "Key" field input the content of the id_rsa.pub file for the jdoe user (e.g., /home/jdoe/.ssh/id_rsa.pub). If one does not exist, go to the back-end of the Linux server, log in as jdoe, run 'ssh-keygen -t rsa -P ""' and press enter to the next prompt.
8. Check the option for "Write access allowed"
9. Click the green "Add key" button.
10. Now go back to server B and run: git push origin master
(This solution could potentially work with BitBucket (but probably not step-by-step). You may need to check the branch name; it may not be "master" but "development" or something else.)