Can sync 2 GitHub accounts together? Enterprise to personal? - github

I have a GitHub Enterprise account from school and I have a personal GitHub account. Throughout my course I have been uploading all of my projects to the enterprise account and although I am told I would have "lifetime" access to said enterprise account, I would still like my work to be attached to my personal account.
Is there a way I could link or sync both of my accounts together? Or a way if I push a repo to my enterprise account it will also push to my personal account at the same time?

The answer is yes, you can push your repo's to multiple GitHub accounts. When you first pull from an account, you have access to said account until further notice, even after you exit your terminal. All you need to do is to push your files to the "main" branch of each GitHub account.
For example. My schools repo main branch is not called "main" it is called "master." So after all the commits I would just git push origin master . This will push it to school. My personal account however is named main. So right after I push to my school I can just git push origin main and it will push it to my personal. Using these two back to back works just fine and it does not matter which one you use first.

Related

Pushing files from one account to other in github

Iam trying to push some changes to other account from another account but it is giving me permission error.I checked the github settings but everything there seems to be right.Can anybody help me with this?
EDIT:
I tried changing my user name and email too still it is giving same error
Some info about the transfer process which might help you
When a repository is transferred between two user accounts, issue assignments are left intact. When you transfer a repository from a user account to an organization, issues assigned to members in the organization remain intact, and all other issue assignees are cleared. Only owners in the organization are allowed to create new issue assignments. When you transfer a repository from an organization to a user account, only issues assigned to the repository's owner are kept, and all other issue assignees are removed.
If the transferred repository contains a GitHub Pages site, then links to the Git repository on the Web and through Git activity are redirected. However, we don't redirect GitHub Pages associated with the repository.
All links to the previous repository location are automatically redirected to the new location. When you use git clone, git fetch, or git push on a transferred repository, these commands will redirect to the new repository location or URL. However, to avoid confusion, I strongly recommend updating any existing local clones to point to the new repository URL. You can do this by using git remote on the command line:
$ git remote set-url origin new_url
Add the collaborator from the initial account (the git account having the repo) and the second account can accept the invitation to be a collaborator
This allows you to change and push the code from different Id also.

Lost write access after transferring a repo

I have a repo created under my personal account https://github.com/ice1000/properties-devkt (it's a fork now), I go to Settings, disabled issues and projects, and transferred the repo to an organization https://github.com/devkt-plugins created by me (I'm the owner of it), and now it becomes https://github.com/devkt-plugins/properties-devkt.
After transferring this repo, I lost write access to it. This is also why I forked this repo to my personal account.
But how is that possible? Am I going to lost write access to a repo which previously owned by me and now owned by my organization?

How to sync remote github repository from one accoun to another remote repository created under second account

I basically have two github private repositories in two different account and I want to set a provision in such way that when the code is pushed to first repository it should automatically available in (sync with) second repository created under different account.
I have referred https://github.com/makefu/repo-sync but didn't help.
Any one has steps to achieve this?
The fact that the mirror GitHub repo is under a different account does not matter, as long as your process has the right credentials (username/password).
If you are alone working on that repo, you can simply push to two different repos, as long as your git credential helper has both credentials memorized.
If you are not alone, and your remote repo can be updated (push) from multiple sources, you need to register a GitHub webhook, and setup a listener able to push events.
You can find an example in webhook.py mentioned in RalfJung/git-mirror.
The idea is to trigger a git fetch repo1 + git push --mirror repo2 in order to keep repo2 in sync with repo1.

Github: Protect a branch but let service accounts push to it

I have a personal website on GitHub Pages. When I merge into develop, my CI is set up to check out master, reset --hard to develop, build the website, and force push to GitHub.
Is there a way I can protect master from being pushed to by anyone else than my CI's service account, so that the only way to update my website is by pushing a verified build to develop?
Since I don't have an organization account, I can't restrict to a particular user using the feature described in this answer.

Github: Repository not found

$ git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
I'm quite sure the repository is there and I added it correctly. The problem may be that I am using two github accounts. One is my personal one and one is for a client. I'm trying to get it on the client's github as a private repository.
I am able to create a repository and push it to my personal github account. But I can't get it to push to my client's account.
You probably do not have permission to push to your client's repository. To get access, the easiest way would be if your personal GitHub account had access to your client's repository.
Ideally your client's account is a GitHub Organisation. That way, an arbitrary number of people can be given permission to access its features. Just add any account as an owner of the organization, or add an account to a team to give access to specific repositories.
If your client's account is not an organisation, you can give yourself access by adding your own account as a collaborator to the repository (in the repository admin settings). That gives you access to the repository from your own account.
If you are trying to use multiple ssh keys to login to different Github accounts depending on which repository you are pushing to, see Multiple GitHub Accounts & SSH Config. However, this is more difficult and is probably unnecessary.