how to un fork the github repository? - github

How can I un-fork a GitHub repository?
I have never seen unfork option - is it possible to do that?

Update: There's now an automated solution
See https://stackoverflow.com/a/66470086/151312
Original Post
As of now Github doesn't have an unfork option, so the only solution is to delete the forked repo.
Warning: The following solution will delete your cloned repo.
If you want unfork without your repo is being deleted try this https://stackoverflow.com/a/41486339/6335029
Step 1: Goto Settings of Repo you want to unfork
Step 2: Click Delete this Repository
Step 3: Enter your name / Repo name
Step 4: click "I understand the consequences, delete this repository" button

GitHub support can do this for you.
Go to this link https://support.github.com/contact?tags=rr-forks
Type in "unfork"
Let the virtual assistant help you
They completed the process for me within 1 minute after that.

Option 1: Rename, import, delete
Rename your old fork (e.g. repo.old)
Import your old fork as a new repo (Note: provide the https:// or git:// URI of the old fork)
Delete / archive the old fork
Note: the "import" option is an option when creating stuff:
Option 2: Clone, delete, create, push
Back up your repo! E.g. git clone to your local file system.
Delete the original repo from GitHub (See the other answer...)
Create a new repo with the same name
Push your local backup to the new GitHub repo
I recommend option 1.
Whatever you do, back up your work! Especially if you follow the other answer, which just tells you to delete your repo...

Unfork without deleting the repository
Go to this link https://support.github.com/request?q=unfork
Click on "Our virtual assistant can help with detaching/unforking a repository"
Click Detach
It will ask for the Repository link
Done.

There isn't a way to do it via the web portal (without cloning/deleting the repo as described in other responses). I put in a request to GitHub support, asking them to convert the repository to 'normal mode', and they did it within five minutes.

You can always send in a ticket and have GH support detach it from the fork network for you. That way you keep the followers, issues, etc.

It's possible, follow these steps:
1- First go to the parent project anf change it's visibility
2- Then do same with the child project
3- Then revert all repositories to thein initial state of visibility.
This worked for me. I hope same for you.

Related

How do I get a cloned project into my own github repository?

Normally I get the project easily to github, but now that the project base has been cloned so I can't push it to my own repo for some security reasons.
I cloned project base using the terminal command
git clone https://github.com/username/project.git
Can anyone help with this? or link to a page where a solution can be found?
If I understand your question, I think you are looking to fork? If so, you will want to fork the original repo, and then clone your fork of it.
If that isn't what you are looking for, my next guess is you want to make the original project a dependency in your personal project. In which case, the solution will depend on your specific tech stack.

Safe way to rename GitHub repository to the name of one I just deleted?

I had 2 repos on Github: "RepoName" and "RepoName_old". I thought I was going to rebuild my project but changed my mind and have been improving "RepoName_old" ever since. I deleted "RepoName".
If I rename "RepoName_old" to "RepoName" (the deleted repository), will something go horribly wrong? The official documentation warns against trying to pull from a branch associated with the old name...I guess that's a different thing...will GitHub Desktop acknowledge the new name after I make the change?
I have terrible experience mismanaging my git repositories and I want to avoid another setback by being informed and careful.
GitHub Desktop is a local tool which should reflect the changes done on GitHub.
On GitHub side, if you have deleted RemoName, you should be able to rename "RepoName_old" to RepoName.
Check first that it works on github.com.
Then try and clone it in command line, and, with GitHub Desktop, add it from your local folder. That should force GitHub Desktop to recognize RepoName with its new origin URL.

How to delete a file from GitHub history without using commandline

I need to remove a file from history. I don't have commandline access to GitHub. Kindly help if this can done through UI itself.
You can't delete the file from history, but you can delete it from the repository by following this help article
Alternatively, you could do a cherry-picking using one of the Git GUIs software, then cherry-pick all the commits, except for the one that you wanted to removed, into a new branch. Then, delete the old branch.
TO achieve this, you have to have command line access.
Delete file from history
But Using UI , you could delete the file from the repo (branch)
Ex:
Click the delete button on top right corner and commit.
You don't need command line access to GitHub, only to your own local clone, where you can:
either do a git filter-branch (example here)
or use BFG
Then you git push --force.
But the alternative, if you really don't want to use any command line, even locally... would be to contact GitHub support, asking them to remove the file from your remote repo history.
That is a last resort option though, since you are supposed to be able to do that on your own.

How do I get a new branch to show up in Eclipse Git Remote Tracking?

I have an existing Eclipse git project, with a master and development branch present in both local, and remote tracking. I have just added a new branch in my git repository, but I can't figure out how to get it to show up in Eclipse.
I have tried to read up on the subject, but it seems like it is just expected to automatically show up. I have found a lot of similar questions, but they all seem to deal with the issues of a completely empty remote tracking folder, instead of my problem of only a single new branch missing. I already have Master and Develop present.
Here is what does not work:
Clicking refresh in the Git repositories window.
Any kind of synchronize, pull or other update I can find
Here is what would work:
Right clicking the remote tracking folder, and selecting "Paste repository path or URI". If I do that, and select the exact same path as is already there, I can see my new branch. This action does require that I completely clone the whole repository to an empty folder again, and that can't be how this is intended to work.
I believe it might work to use some kind of command line tool, but I really want an Eclipse solution to this, as I feel sure it exists, and I am just missing something.
In the Git Repositories view:
Right-click the repository and choose Fetch from Upstream
If the new branch will not shown up below Branches/Remote Tracking, you have to configure fetch:
Right-click the fetch node below Remotes/origin and choose Configure Fetch...
In the Configure Fetch make sure there is only the single Ref mapping (assuming the remote is named origin) +refs/heads/*:refs/remotes/origin/*:
In case you do not see Fetch from Upstream after right-click the repository, you may look for Fetch from origin.
For me the solution was almost what Joshua suggested, however it did not work as described. For me the solution was to configure the [remote "origin"] property as follows:
[remote "origin"]
url = your_git_url.git
fetch = refs/heads/*:refs/remotes/origin/*
Alternatively, you can do it from the Eclipse UI too:
Fetch from origin... then hit Configure... and in the configuration window hit Advanced... and there you have the option to Add predefined specification where you can selec Add All Branches Spec. This will result in the same configuration as above:
Maybe you have to remove your original entry which will be pointed out as a duplicate by Eclipse.
You need to modify the "config" file in your local git repository folder. For example, you cloned a remote branch Project into c:\git\MyProject local folder. In this folder there is a hidden folder ".git" that has a "config" file. There is a section in this file resembling the below
[remote "origin"]
url http://xxxxxxxxxxxxxxxx
fetch = +refs/heads/Project:refs/remotes/origin/Project
You need to modify this section as below
[remote "origin"]
url http://xxxxxxxxxxxxxxxx
fetch = +refs/heads/:refs/remotes/origin/
Then go back to Eclipse IDE, right click on the repository and do a "fetch from origin". Now all the branches will show up.
What I did:
1: disconnected.
2. refresh and pull. Then, it shows the new branch
3. create local and pull.

Integrating Eclipse and GitHub

I am in need of help in trying to setup Eclipse so that I can push my code onto my GitHub account. I've searched online and the tutorials I have found are either outdated or don't work for me.
I already have a project on Eclipse. How would I put that code onto GitHub? Would someone please add detailed instructions please. Any help is appreciated.
EDIT
As soon as I posted this question, and fiddling around with the settings I managed to get it to work! What a coincidence...
The only problem I have now is how do I set it up so that when I commit it will only select the files in the project folder? Right now it is showing all 600 files in the Package Explorer.
Alright, there are several ways of doing this. I found this to be the easiest way:
First, set up SSH2 configurations. Go to Windows->Preferences->General->Network Connections->SSH2->Key Management and Generate RSA Key. Save Key
Copy that key. You will need to go to your GitHub account settings and add the new SSH key to your account.
Now, you need to install eGit:
Next, you want to add the Git Repositories view:
Create a new Git Repository. I have already created a repository called Java. I will refer to that repo for the rest of the explanation.
After you create your repository, it should show up in the Git Repositories view. Now to add your project to the repository, right click on your project and select Team->Share Project.
Select the repository you just created. You can also use CTRL+ to select multiple projects and place them in one repository.
Now go back to your Git Repositories view. Go to Remotes . Right click and select Create Remote.
Select Change... and enter the SSH link for your Repository on GitHub.
For connection, select SSH. Then press Finish.
For Rev-mapping, select Advanced....
For Source Ref select refs/heads/master. And then press Add Spec, then select Save specifications in 'origin' configuration. Then press finish.
That's pretty much it. You can commit changes by right clicking your project - >Team->Commit...`
Push new commits to GitHub:
This is a really good explanation on how to set up Eclipse pull requests.
The current branch is not configured for pull No value for key branch.master.merge found in configuration