Github do not count my commit - eclipse

This is the story.
I have two computers, one is in my home, another is in my office. Both computers have installed Eclipse and connect to the same project of my github account wtih Egit. I find that when I commit on my home computer, my commit will be recorded and display on my contribution graph. However, when I commit on my office computer, commits will not be recorded.
To solve this problem, I delete projects both on my home computer and office computer, and create new project by cloning corresponding project on github.com with identical steps. Furthermore, I use the same eclipse version, they are the newest Mars. However, the problem still remains, commits on home computer will be recorded, and the other will not.
I searched the Internet and can not find the answer. Is there anybody here can help me out? Thanks in advance!
Problem solved. If someone else meet the similar problem, the following link will be quite useful. https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user

Just add your second machines SSH key (assuming you use them) to your account and you should be set. then clone your existing project from the repo, and start working normally. any changes, just commit/push, and from the other machine you can always pull any updates, vice versa.
Commits will appear on your contributions graph if they meet all of the following conditions:
The commits were made within the past year.
The email address used for the commits is associated with your GitHub account.
The commits were made in a standalone repository, not a fork.
The commits were made:
In the repository's default branch (usually master)
In the gh-pages branch (for repositories with Project Pages sites)
In addition, at least one of the following must be true:
You are a collaborator on the repository or are a member of the organization - that owns the repository.
You have forked the repository.
You have opened a pull request or issue in the repository.
You have starred the repository.
Contributions to private repositories will only appear to users who can access those repositories. Those contributions are not rendered for users who cannot access those repositories.

Related

How to add my unrecorded GitHub contributions to my updated settings

I've done a lot of work in our company GitHub org, but I did not notice that I am not a contributor in any of the repositories I have worked on. when I check my GitHub profile and see the graph, it has all my contributions green light, but when I check each repos, I am not one of the contributors.
I searched the internet and I found out that I haven't set up my local identity
git config --global user.email and it is empty.
I fixed it, and new pushes and commits are now showing, but my problem now and my question is; is it still possible to have my previous contributions appear in the repositories tied up with my email?

Why is Github not picking up my contributions once I've connected my application to Netlify?

I've deployed an app on Netlify through continuous deployment by linking a single Github repo. I had previously been making commits to the project locally, and my contributions were being tracked for this repo. However, now that I've linked the repo to Netlify, it seems no commits or contributions I make are picked up by Github. The commits can still be seen in the Github repo and commits are updated, but the contributions no longer are tracked despite them working previously.
For some context I've checked the Github help page on contributions:
https://help.github.com/en/github/setting-up-and-managing-your-github-profile/why-are-my-contributions-not-showing-up-on-my-profile
And cannot see what rule I've violated; I'm working on this on my own, it's a standalone repo, etc etc. considering they were being tracked before for the same repo, I'm confused as to what has changed now that Netlify has been integrated.
Any help/guidance appreciated
So it had nothing to do with Netlify, but my work Mac did not have me globally installed as the commit author with my email. After that, all previous authors were wrong as being my local computer email.
To get around this I followed this tutorial to replace all previous commits with the correct author: How do I change the author and committer name/email for multiple commits?

Some confusion about the traffic of github repo?

As the pictures show below, the git clones of my repo is 26, and the visitor of my repo is 4. According to the literal meaning, the cloners means who look my repo page and decide to clone my repo to local or somewhere, and also, in the meantime, they should become the visitors of my repo. However, the traffic data of my repo shows that the results of visitors and cloners are much different from each other.
My insight of visitor and coloner is right? What is the GitHub official definition of the cloners and visitors? Or, the significant difference that shows on my picture just caused by the bug of GitHub.
The command git clone http://url will clone the repo without visiting GitHub. Maybe your repo's name is an easy misspelling of another repo, or someone attempted to download all repos by cloning from a list of URLs, looking for loose passwords or doing statistical research.
It could be cloned by you from another IP (other home/TOR/VPN) or you told someone about the repo and someone cloned it without visiting the page.
Do you have a CI/CD server or a DevOps pipeline?
These will clone your repo automatically when triggered by a commit or
a pull request.

Un-fork GitHub project into new GitHub project not associated with the original [duplicate]

How can I make GitHub forget or disassociate that my repo was originally a fork of another project?
I forked a project in GitHub. I can now see "forked from whatever/whatever". The parent repository "whatever/whatever" is no longer maintained. I have been allowed to continue use of the code base of the original repository to create an independent repository.
Is there a way to detach my project from the original repository?
Update Jan 2022:
Use the GitHub chatbot-virtual-assistant at https://support.github.com/contact?tags=rr-forks&subject=Detach%20Fork&flow=detach_fork
First answer:
You can contact github support and ask them to switch your repository to "normal mode".
On this page, "Commit was made in a fork" paragraph, it is explained that one has to go through support to switch. Therefore, it is likely that there is no way to do that by yourself (unless you destroy and recreate your repo which is explained before... if you do so be careful if you have tickets or a wiki attached to your project as they will be deleted!).
You could duplicate the forked repository to a new repository (without the fork dependency) from the GitHub UI, then remove the original forked one:
Sign in to GitHub
Select the + sign in the top right corner and select Import repository.
Import your forked repository. The new repository won't have the fork dependency.
Delete the original, forked repository in the repository settings.
NOTE: This approach will not preserve issues and pull requests.
Make sure you have all the important branches and tags on your local repo, delete the github repo, recreate the repository through usual means (no forking) and push the local repository back with git push --all. Note that if you have local branches that you don't want to publish, might be worth to create a temporary clean local clone for the operation.
However, this will also get rid of wiki and issues. As the wiki is in fact it's own repository, it can be handled similarly by cloning it and then recreating and pushing. The repo address is on wiki's Git Access page (git#github.com:user/repo.wiki.git).
This leaves issues. They can be exported through the API, but as far as I know, you can only create issues and comments with your person, so importing them perfectly is impossible.
So, if you need issues to be preserved, you should go through github support as Thomas Moulard suggests.
I got the similar problem, and ended up using this github help page to solve it. I didn't mind about the wiki and issues tracker as it was for my blog using a theme kindly developed by another user.
To detach a forked repo and use it as your own after several commits without losing the whole history:
git clone --bare git#github.com:user/forked_repo.git
Create a new empty reposity new-repository on the github website.
And push a mirrored version:
cd user.github.com.git/
git push --mirror git#github.com:user/new-repository.git
One can rename on github, the forked_repository with another name to keep it as backup and check updates if needed. Or simply delete it.
Renaming the new-repository to the original name does the job. As a side effect, your commits now appear in your history.
Log in to GitHub with your credentials.
Go to https://support.github.com/contact?tags=rr-forks&subject=Detach%20Fork&flow=detach_fork.
Choose "Detach", then enter the URL or repo name of the fork as your-user-name/repository-name, and answer the other questions of the virtual assistant.
You will get an email with a ticket number where you can check the status of your request. You will also be notified per email once your repo has been deforked.
Most repository settings will stay unchanged, including user permissions, stargazers, issues, PRs, discussions, etc.
Using the info from aurelien and Clayton, I was able to do this with the following:
$ git clone --bare https://github.com/my/forked_repo.git
<delete forked_repo on GitHub>
<recreate repo on GitHub using same name>
$ cd forked_repo.git
$ git push --mirror
Here's the documentation for git clone --bare:
Make a bare Git repository. That is, instead of creating <directory> and placing the administrative files in <directory>/.git, make the <directory> itself the $GIT_DIR. This obviously implies the -n because there is nowhere to check out the working tree. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to refs/remotes/origin/. When this option is used, neither remote-tracking branches nor the related configuration variables are created.
Here's the documentation for git push --mirror:
Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote.<remote>.mirror is set.
Note: like the other git based answers, this will not copy over issues that are not part of the git repo such as the wiki and issues. Per Tapio:
The wiki is a separate git repo and can be handled in a similar fashion per Tapio. The address is: git#github.com:user/repo.wiki.git.
Issues can be exported via the GitHub API but there are issues recreating them since they can only be created by your user, so imports will lose information.
This only applies to GitHub Enterprise, not on github.com
Logged in to an account that has admin privileges:
Go to the repository that you need to detach: https://<ghe url>/<org>/<repo>
Click on the “Site Admin” rocket on the top right corner
Click "Collaboration" on the top menu bar
Click on “Network” on the left pane
Click on “Make Root” in the Network Structure pane
Accept
This was tested on GitHub Enterprise 2.9
If you do not need any past commits (I didn't in my case), you can just:
fork the project
make a local copy of the fork (I used my IDE to do that)
delete the git folder from your local copy
commit the project as you normally would a new project.
You can just delete the fork from your github account after. Took me all of one minute and worked like a charm.

Using GitHub and Eclipse to pull code

I have a repo on GitHub here.
I have pushed to this repo from two different machines, so now one machine is current and another has outdated code. Right now, I am on the machine with outdated code, and I want to pull in the master/HEAD/whatever from GitHub.
And then I get to stare at this:
I do not want to do something stupid like delete the project from Eclipse and then pull in all the code from GitHub.
Can someone please help me merge/synchronize the projects? This is as simple as it sounds.
Unfortunately, this is what happens when I click "Pull" on the above menu:
Would someone also explain what the difference is between Pull, Merge, Fetch and Synchronize?
eGit doesn't know, which remote branch you want to pull from.
If you create your local branch based on a remote tracking branch, then the key is generated automatically. Otherwise you have to create it yourself:
branch.master.merge=refs/heads/master
branch.master.remote=origin
where master stands for the branchname, in the key it's your local branch, in the value it's the branch in the remote repository. Place that in the repository-specific configuration file %repositorypath%\.git\config
As for the terms:
merge: join two or more development histories together
fetch: download objects and refs from another repository
pull: fetch from and merge with another repository or local branch
sync: allows you to compare 2 branches
In general, I urge you to read eGit user guide, where you can get even better understanding of Git and eGit. It can be found at http://wiki.eclipse.org/EGit/User_Guide