gitlab giving users code download rights but no rights to see project - gitlab

Is there a way in gitlab to disable a project from showing up as a project if the user only has guest level privileges?
To clarify and add a little more detail.
I have added the ability for guest to download code but removed pretty much every privellege regarding actually using gitlab to look at the project. Which means that if the project shows up as a project to the user and they click on it gitlab returns an error. I would much rather gitlab not show the project at if the user has guest level access.
We use git submodules in our projects and we need to be able to give people the ability to clone a repo and all it submodules without giving everyone access to browse and find every project that can be a submodule or making projects public.

Currently not. But feel fee to create a PR which add's this functionality

Related

How to merge a Git branch using a different identity?

We are using Git for a website project where the develop branch will be the source of the test server, and the master branch will serve as the source for the live, production site. The reason being to keep the git-related steps (switching branches, pushing and pulling) to a minimum for the intended user population. It should be possible for these (not extremely technical) users to run a script that will merge develop into master, after being alerted that this would be pushed to live. master cannot be modified by normal users, only one special user can do the merge.
This is where I'm not sure how to integrate this identity change into my code below:
https://gist.github.com/jfix/9fb7d9e2510d112e83ee49af0fb9e27f
I'm using the simple-git npm library. But more generally, I'm not sure whether what I want to do is actually possible as I can't seem to find information about this anywhere.
My intention would be of course to use a Github personal token instead of a password.
Git itself doesn't do anything about user or permission management. So, the short answer is, don't try to do anything sneaky. Rather, use Github's user accounts they way they were intended.
What I suggest is to give this special user their own Github account, with their own copy of the repo. Let's say the main repo is at https://github.com/yourteam/repo, and the special repo is at https://github.com/special/repo.
The script will pull changes from the team repo's develop branch, and merge this into it's own master branch and push to https://github.com/special/repo.
Then, it will push its changes to the team's master branch. This step can optionally be a forced push, since no one else is supposed to mess with master, anyway. (In case someone does, using a forced push here means they have to fix their local repo to match the team repo later on, rather than having the script fail until someone fixes the team repo.)
At the same time, your CI software will notice that master has changed at https://github.com/special/repo, and will publish as you normally would. This is the linchpin: the CI doesn't pay attention to the team repo, so although your team has permission to change it, those changes don't make it into production.
This special user will need commit access to the team repo, in addition to its own GitHub repo. The easiest way is probably to use an SSH key, and run the git push command from the script, rather than trying to use the GitHub API.

Can I raise a Pull Request(bit-bucket) from android studio IDE [duplicate]

I forked application to android studio and when I try to make a pull request:
I get :
Can't Create Pull Request
Push failed:
failed to push some refs to 'https://github.com/projectname.git'
What is the right way to do that?
Note :
I can commit and update my projects but I can't make pull request to other projects.
This is obviously an authentication problem. There are WAY too many unknowns, so I doubt anyone can give you a definitive answer. Here are the steps to investigate in order to solve it:
Is your GitHub Account authenticated with your Android Studio installation? Check your Android Studio Settings.
In order to authenticate you need to generate an Access Token through your Github account settings and use that token as seen in the picture above. When generating a new token, normally I would advise you to be careful with the permissions you grant to it. For debugging your issue, generate a new one with full access to everything and delete it as soon as you resolve your issue.
Last, if both of the above steps are done correctly and you still can't open a PR. Make sure the repository you trying to open a PR on, allows third party users to perform such actions.
NOTE: You can always commit code in your local repository. That lives in your local environment (a.k.a. your computer) and you have full permission to do whatever you please with it. That doesn't mean the changes you do locally, will be reflected in the remote repository (a.k.a. the one hosted at Github servers).
First you need to install git client and configure with Android studio then you need to enable git into android studio from VCS option. and then you can see on toolbar 2 icon will come for push and pull request.
by these two option you can do pull and push very easly.
please have look this.
http://prntscr.com/hgvbxw
reference-https://javapapers.com/android/android-studio-git-tutorial/

Gitlab change default branch for every project

I am currently using GitLab Community Edition 9.0.0 and want to change default branch to "develop" for every project.
I know it can be done by project settings page but since we have almost 200 projects, is there easy way to do it?
You could use the Gitlab API to:
Get a list of all the projects (see here)
Loop on that list and edit every project to set the default_branch parameter (see here)
Here's more documentation on how to use the API.
You fist need to get a user's private token. Go to http://<gitlab_domain>/profile/account to get/generate one for your currently logged in user. You may want to do that as the gitlab administrator in order to have access to and be able to modify all those projects.
Then you need to generate the proper requests (see links above and this).

how to set permission in Git?

I am new to Git and after I lots of searching I found that I must have set Linux permissions in my Git server.
But I want to know, is it possible to set permissions in Git?
I am working on a team about six people and I don't like to everyone on the team can access all the project for security reasons.
For example, If somebody in my team works on UI in my Store section I want to he/she have it's own branch but when he/she PULL the project with Git just have access to files and folders I let.
I have to add that I have my own Git server on a local network using Linux Debian and I'm using "SourceTree" as my GUI for Git and I have few experience on Git command line, so I need do it from GUI if possible.
Edited:
Does Git lab support permission like this: I have a repository that uses Laravel framework and I'd like to set permission for UI developers that only access views and PHP developers access some controllers not all the part of the controller in the project.
You can checkout GitLab: https://about.gitlab.com/ for this. Out of the box git does not support what you need/want.
No, Git doesn't manage this directly. Anyone with authentication credentials to the repository has access to the entire repository.
Traditionally, this is managed with third-party solutions, such as Gitolite, GitHub private repositories, and other systems.
In addition to other answers: if you want only certain parts of project to be accessible to each developer, you can use git submodules.
This is also preferable if project has logically and functionally separate parts. (Like front-end and back-end. )

Possible to have multiple git users logged in as root?

Is it possible to have multiple git users logged as the same Linux user?
What I would like is that multiple admins can login as root, make a git pull to a directory assigned to them, and then git push, but so we still can see who made which changes in the git log?
Each one of your users can clone the repo for his own. That repository would have his config.user and config.email according to the person using it, and they all pull and push to the same "central" repo.
Anyway, they are all root, so there's not much to do about preventing one of this admins to commit as another one. But if they aren't evil, you can do this.
gitosis can surely help to access control the repository, too, if needed.
Personally I would say that the correct mechanism to make sure that you can track changes in this sort of case would be not to have root as a permitted username for your repository. They would all have to commit with their individual user names by logging in as themselves.
In general nobody should be logged in as root other than very briefly while performing a specific task such as installing a new package - not all of the time while developing so anything you do to make such practices unrewarding is good.
It would be safer to manage that kind of access control with an authorization layer like gitolite, instead of relying on system account.
That way, you are controlling who can pull what.
Although that wouldn't control the "where" part (where the users would pull those repos to)

Resources