Combine gitlab heatmap commit with github account - github

I have been using my university private gitlab for a while. I have a lot of commit that can be shown like this Gitlab commit
I cannot give the link to my gitlab to potential recruiter. So I decided to create a github and put my repositories there.
On my github I create a new repo and locally I just do:
git remote add origin2 git#github.com:mylogin/new_repo.git
git branch -M main
git push origin2 -u main
I can see the commit inside the repo, but on my github heat map it is showing as one big commit. I want it to show all my previous commit inside my github.
I don't know if it possible.
Please help.

I think maybe you see on Github is not commit, it is a event that you join Github.
Just like:
Accroding to docs:
Commits must be made with an email address that is connected to your account on GitHub.com, or the GitHub-provided noreply email address provided to you in your email settings, in order to appear on your contributions graph.
So, you can add email address which you commit on Gitlab to your Github account. After this, the contributions will be counted and shown.
Follow this guide to set up your commit email address on Github:
https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-email-preferences/setting-your-commit-email-address#setting-your-commit-email-address-on-github

Related

GitHub says authored and committed different people but it's the same person and same account

I am confused, GitHub shows me as two different people. I use the same account when pushing from my local repos and then checking it on GitHub.
I only have one account on GitHub. So it's a surprise to me I'd be shown as two different people.
It happens when you don't have the same email address on your local git configuration and on your GitHub account.
You can set your email address in git with this command:
git config --global user.email "email#example.com"
And on GitHub at this address: https://github.com/settings/emails
For more information, see GitHub's help:
Why are my commits linked to the wrong user?
Why is my commit associated with the wrong person?
Note that the changes will take effect for next commits, the commit history won't be changed, if you want to change the author or committer on already existing commits, you'll have to amend them.
Also had the same issue. This strange behaviour apparently only happens to me when the locally configured git email has caps:
Commits:
$ git log --pretty=full
commit b1149b046e31a82de34d550dda53637908d1956b (HEAD -> feature1,
origin/feature1)
Author: Sam <emailwithCaps#gmail.com>
Commit: Sam <emailwithCaps#gmail.com>
caps email
commit 0e1dcabfa7d3dc7f1333d2c15967ca6288515e42
Author: Sam <nonexistingemail#gmail.com>
Commit: Sam <nonexistingemail#gmail.com>
aasss2wq
As you can see, Author and Commiter have the same name and email on the commits.
On GitHub:
Commit Email with caps vs no caps on GitHub
Not sure why it happens.
Concluing: Making all characters lower case in the local git config user.email seemed to solve this for me.

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.

Download commit messages from project in GitHub

I have a project in GitHub and during the last years I have committed several changes to the project. In each commit I was adding a small text about the commit (e.g. fix problem with function A).
Is there a way to download all the commits that I have committed so far ?. I don't want to download the changes of the code of each commit, just only the text that I was writing.. Is this possible?
GitHub has an API for that.
https://api.github.com/repos/(username)/(repository)/commits
See REST API v3: Commits
List commits on a repository
GET /repos/:owner/:repo/commits
You can then just read all message keys in the commit objects
Edit:
If you try to do that on a private repository, you have to make an authentication first.
Basic example with curl:
curl -u username:password https://api.github.com/repos/username/repository/commits
More on that: Other Authentication Methods
Assuming you did the work from your local Git project, then GitHub does not have to be involved at all here. You can checkout the branch in question, fetch update it, and then use git log:
git checkout master # assuming contributions go to the master branch
git pull origin master
git log --author="yaylitzis" # replace 'yaylitzis' with your actual username
The pull is required because perhaps your local branch does not have all your commits for some reason.

Github: how to restrict commits on a public repository

Is there a way to restrict users from making commits to a public repository? I may understand incorrectly, but private repos are not free, and also for private, users cannot access the repo unless invited as a collaborator. I would like GH users to still access the repo, but not able to push commits to it.
Thanks.
EDIT:
Thanks I looked at the link. It it still not clear to me because I used the clone url on the repo page and was able to clone and push to the master branch on the repo without even setting config user.name and user.email, which in my opinion seems like anyone else can do this as well.
I didn't notice a difference in read only git:// in the clone url as opposed to the read and write access way with git#. When I tried to push to another's repo using https (which has both read and write access), I got a 403 error (authentication error). The message included my GH username, which made me curious as to how GH knew that. Turns out they have a copy of the computer key that is initiating a push. So finally, only owners and collaborators can push to a repo. I was able to push to my own repo with the https because of my key.
git github cannot push to origin
How does GitHub handle push security?
You can try the Branch protection rule. it will restrict commits up to an extent. It is under Settings --> Branch

How to take update from github repository?

I have installed GitHub Client to my system.
I have easy to commit my changes to the repository. But my colleague tried to take my update, he is not able to took the app from repository.
We are having GitHub private repository.
Kindly let me know to solve this issue.
The similar question has been asked before follow this link hope it may help you.
Basic flow is like this.
# clone the repository (from github, for example)
git clone git#github.com:username/reponame.git
cd reponame
# edit some files
# add them to the index
git add file1.txt
git add file2.gif
# review your changes
git status
# commit the changes
git commit -m "Decription of my change"
# push them back to the remote repository
git push origin master
If your colleague is supposed to:
access your private repo
be able to contribute back (git push) directly to that private repo
you should add him/her to the list of collaborators for this project: see "GitHub help page".
Note that Users can always collaborate on private repositories, even on the free plan.
I.e. if a user has a GitHub account (even a free one), he/she can be added to a private repository.