4

I want to create a repository on Github such that I can set the date of repository created in past. I need to do this because I am new to github and want to upload all my past projects on github exactly on the date I completed the projects.

Please help. Thanks in advance!

vacky
  • 277
  • 1
  • 4
  • 16
  • 3
    This sounds like a good way to cheat on your assignments, by making it appear that it were on time, when in fact you waited for the answers to come out first. Besides that, Git is pretty rigid about timestamping events, and I don't know if there is a way to do this. – Tim Biegeleisen Feb 22 '17 at 05:31
  • 2
    @TimBiegeleisen LOL. I dont want to cheat on my assignments. Just wanted to add the old projects on github. – vacky Feb 22 '17 at 05:47
  • TBH it does seem a lot like a cheat attempt, why would anyone want to do this but to trick their TA's :) – buræquete Feb 22 '17 at 05:55

3 Answers3

2

The project date is based on the project-wide git repo (the date you create the .git folder inside the project by default) creation date not the date you Create project on Github.

You can actually set the timestamp for an old commit in Git. How can one change the timestamp of an old commit in Git?

Community
  • 1
  • 1
XY L
  • 25,431
  • 14
  • 84
  • 143
  • Can you please tell me what do you mean by "project-wide git repo creation date " – vacky Feb 22 '17 at 05:49
  • @LiXinyang Actually there is _no_ way to alter the timestamp of a commit in Git. The link you mentioned suggests rebase/filter branch, which rewrites history, creating _new_ commits in the process. – Tim Biegeleisen Feb 22 '17 at 05:51
  • 1
    okay got it. But unfortunately I never created such .git folder. – vacky Feb 22 '17 at 05:51
  • If that is the case, he might want to replay each commit with the past date. I actually had done the same thing before. – XY L Feb 22 '17 at 05:52
  • `.git` folder is created when you do `git init` @vacky – XY L Feb 22 '17 at 05:52
  • https://github.com/angusshire/greenhat, checkout this project. It create commit with past date – XY L Feb 22 '17 at 05:53
1

There is no option for manually set the Created Date For a Repository and the date of creation is not a matter.The thing is the TimeStamp of Your your first Commit That's all. Check this for more info about your repository https://api.github.com/repos/username/repository_name and https://api.github.com/repos/username/repository_name/commits and also check this too for Change the Date of Old Commits

Community
  • 1
  • 1
RAJESH KUMAR ARUMUGAM
  • 1,560
  • 21
  • 35
0

You can change the date of the commits but that won't change the date of the repository which is visible via the API: https://developer.github.com/v3/repos/#get-a-repository. So AFAIK you cannot change it.

thisismydesign
  • 21,553
  • 9
  • 123
  • 126