Payal Payal - 10 months ago 65
PHP Question

Developer role not able to push to unprotected branches in Gitlab

I am new to gitlab. I have successfully created unprotected branches dev & design with master role in project testapp with the following commands:

git checkout -b dev
git checkout -b design

Then I push all the files successfully to both branches.

Later on I run the following command to make my branches remotely :

git branch dev
git branch design

Now the issue is, my team member whom I have added in project with developer role is not able to list out branches dev & design and also not able to push to those branches. He try to push with following commands:

git add .
git commit
git push -u origin dev

Please list the steps for me.

Answer Source

Sounds like your teammate needs to run the checkout command to track the remote branches. Whether or not he has local dev/design branches, he just needs to associate them with their corresponding remote branches. This is done by creating a tracking branch:

Tracking branches are local branches that have a direct relationship to a remote branch.

To create new tracking branches locally, you can use the shorthand:

git checkout dev
git checkout design

Where the general form is:

git checkout -b [branch] [remotename]/[branch]


git checkout --track origin/dev
git checkout --track origin/design

Or, if you'd would rather turn an existing local branch into a tracking branch, check out this post.