Pushing files from one account to other in github - 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.

Related

difference btw local account and github account?

What is the difference between the local account that I set in git bash with git config --global user.name and my actual github account login. I have a test repo, in there I have added a few collaborators. When I push to the repo, the history will show my local name and not my github account username. How come ?
GitHub is not git. GitHub is a remote repository management application. It has its own authentication and account system. You can push git repositories to it so that they can be shared and controlled.
The "local" variables that you set through git config are ways to make it faster to set the author of a commit.
There is nothing stopping you from pushing commits authored by someone who is "not you" to a GitHub remote that you control. I believe they will be associatively "linked" if the emails match, but it's not enforced or required.

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: 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

github: push project from eclipse to remote repository for first time and no credentials asked

I have a project in eclipse in my local workspace.
I created a github public account, created a remote repository, copied the HTTPS clone URL.
Then cloned the Git repository to create my local repository, and shared the project with the local repository, configured Git for merge and fetch, and committed my changes to local repository, and then successfully pushed the committed changes to the remote repository. I can see the changes in remote repository.
There was username and password fields when I tried to clone the git repository, but I left as blank, and did not give my github account details.
Question: I am so surprised that nowhere I was prompted for a username and password. Does this mean, anybody can push changes to my remote repository? If not, How was I recognized?
then successfully pushed the committed changes to the remote repository
That means you must have logged in to GitHub at one point: even without any repo, you can put your GitHub credentials in the GitHub for Windows/Mac (assuming you are using that GUI)
Once logged in, any repo you are adding can be push to if the GUI detects that your initial credentials match the owner of that repo.
And as Paul Betts would insist, said credentials are cached.

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.