fork repo from personal account into organisation acount - github

I developed a project on my personal github account.
I'm a member (not owner) of an organisation and would like to fork my project in the organisational account, such that the organisation can help maintain it in the future.
How is this done best?
As far as I understood, when I transfer or perform an import into the organisation account from my personal repo, I loose the project in my account which I don't want.
I'm sorry in case this is a "stupid" question - I'm pretty new to git and github...

Any reason not to transfer it, then fork it again back to your account?
That way you can still raise pull requests from your person fork back to the main one.

Thanks for all the answers.
According to the github support team:
Importing is intended to bring code from outside GitHub into GitHub, so that wouldn't be suitable.
and
Transferring would indeed mean you no longer had the repository on your account.
The solution for me was:
requested owner priviledges for the organisation (in case that would not be possible, ask an owner to perform the following steps)
went to the repository which I wanted to fork (In my case, this was on my personal profile and I was logged in with my personal account. I don't have any login informations for the organisation account)
pressed fork and there was a pop-up, asking for where to fork this repo
selected the organisation
I hope to help others in the future with this :-)

you should be able to import without loosing the project in your personal account.
This is what IMO makes the difference between transfer and import.
Be sure to login with your organizational account, if you have two separate accounts

Related

Merge two github accounts

Is it possible to merge two GitHub accounts into one?
I had one work account but would like to merge into a personal one.
I found some details about transferring ownership of the own repos which will merge all commit history etc.
Could anyone please confirm if it will transfer all commit history for any contributions made to another third party repos?
What will happen in the third party repos where I have made contributions from work account after the work account is deleted?
That is what describes "Merging multiple personal accounts"
And its repository transfer process (from the account you want to delete to the account you want to keep) should transfer issues, pull requests, and wikis.
You will need to add the email address you used to author the commits (of the old account) to the account you're keeping.
That way, your old contributions will be preserved.
I logged a support ticket with github and below is the summary:
After deleting work account and following steps as mentioned https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository did not bring contributions across to the personal account.
As work account was deleted - it started showing as a ghost account.
The commits made through work account were as from the personal acccount but contribution history (PR or any reviews) didn't come across to the personal account.
So make sure you think of above steps before removing any of your Github account.
Below were responses from Github:
As pull requests, issues and all activity in the GitHub web UI excluding commits are directly tied to the account that created them, they will not be counted on the new account even if you add the old account's email address to the new account.
Pull requests are replaced with the ghost user when the account is deleted. On the other hand, we read the email address from the metadata stored inside a commit and attempt to match commits up with a user account, so those that meet the contribution criteria will be counted on the new account.

Allow admins (not owners) to create repos in Github

Is it possible to limit who can create repositories in a Github organization. From this article: https://help.github.com/en/enterprise/2.14/user/articles/restricting-repository-creation-in-your-organization it seems like the options are basically owners or everyone. Is there a middle ground?
Making someone a Github owner is a serious permission so we really don't want to give that out just so that someone can make a repo. On the other hand allowing everyone in the organization the ability (contractors, non-technical, read-only roles) the permission to make repos seems too broad.
Has anyone come up with a better solution for this?
One workaround would be to setup a webhook.
That means having a listener for a repository event, which does include the owner: If said owner is not part of an admin list, the listener could:
send back an email to the owner of the newly created repostory, explaining that creation has been denied
delete the repository (through the GitHub API)

If you add a collaborator to a github public repo can they delete or damage anything?

We are setting up a open source project which we would like to allow freelancers to develop alongside us without damaging anything.
In general can the collaborators make changes to repositories without admins being able to check the changes over before code is merged into master.
What is the best method to use to prevent the repository from user damage whilst working with a large number of public freelance developers / users?
What you can do is you can give them read-only permission. They can fork to their own account and start working on that code. Then after finishing a feature they can create a pull request to merge it back to the main repo.
For a Personal account on Github, there are two types of 'roles' - Owner and Collaborator.
For a full list of who can do what - see here:
https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/permission-levels-for-a-personal-account-repository
To answer your question - "No - A collaborator cannot delete a repository"

github: transfer ownership and fork

I've transfered ownership of one of my github repositories (rdmuller/docToolchain) to an organisation (docToolchain/docToolchain).
So far, so good. All old URLs are redirected to the new location. Perfect.
But how do I now fork this repository? I fear that, if I fork it, a fork with the name of the old repository (rdmueller/docToolchain) will be created and the redirect will be broken this way...
how can I avoid this?
So, I guess I found a workaround.
suppose you have a repository
user1/repo1
You now want to transfer ownership to org1 and create a fork of it in your account user1.
The problem is that, if you create this fork directly, there will be again a repo called user1/repo1 and github is not able to redirect URLs to the old repository to org1/repo1
Solution:
transfer ownership from user1/repo1 to org1/repo1
create a temporary organisation org2
fork org1/repo1 to org2/repo1
rename org2/repo1 to something like org2/repo1-fork
transfer ownership from org2/repo1-fork to user1/repo1-fork
this seems to do the trick.
Since May 2020, Ben Balter (Senior Product Manager working on Community and Safety at #GitHub) mentions in his tweet:
We're beta testing a new GitHub feature that allows you to invite someone to manage your open source projects in the event that you are unable able to do so yourself.
If you'd like early access, reply or DM with your GitHub handle and I can add you.
See "Maintaining ownership continuity of your user account's repositories"
You can invite someone to manage your user owned repositories if you are not able to.
We recommend inviting another GitHub user to be your successor, to manage your user owned repositories if you cannot. As a successor, they will have permission to:
Archive your public repositories.
Transfer your public repositories to their own user owned account.
Transfer your public repositories to an organization where they can create repositories.

Direct link/access of a githib repos from another github account?

This might be a naive question. I have couple of repos on my github account (say on account A). For the purpose of publications I should push my projects to someone else's github account (account B) and provide the other repos link in the publication.
I would like to (1) keep the credit of my codes even when repos are in his account, (2) do not update account B if repos in A changed. Account B will not do any development on code, and only its used for providing it's URL in publications.
My question is that, is there anyway to have a direct link from my repos in account B to account A? I think with fetching or a basic mirroring, account B should keep updating the original repos regularly, but I want to avoid it.
What I want is either:
1) a direct link that when clients click on it on account B, they will be directed to my repos on account A.
2) or if the above is not possible, by cloning from account B, clients get files directly from repos on account A.
Any ideas if it (or anything similar to it) is possible? Thanks.
Git has something for this exact thing - it's called submodules. From the Git website:
Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.
Check out the answer to this question - it has a bit more detail (credit to #Jefromi): https://stackoverflow.com/a/4377799/1442788