callmeben
callmeben

Reputation: 61

GIT push issue: please make sure you have the correct access rights

I can clone the code from git server, but I can not push my code.

I prepare to push the code.

First, I execute the command git add, it's OK;

Second, I execute the command git commit, it's OK;

Third,I execute the command git push, the screen prints the information

  fatal:upload denied for project '------'
  fatal:could not read from remote repository
  please make sure you have the correct access rights.

Addition, there is no file "know_hosts" in the folder ".ssh".

How can I resolve the question?

Thanks very much!

Upvotes: 6

Views: 28451

Answers (2)

dnl-blkv
dnl-blkv

Reputation: 2128

When you are doing git add, you are modifying the local repository, as well as in git commit case.

On the other hand, when you are doing git push, you are trying to push from your local repository to the remote one.

In your case, the most possible reason is that you actually don't have the required access rights. According to my experience, that commonly occurs for one of the three reasons:

  1. You are pushing to a wrong repository (check its URL).

  2. You are using SSH without the SSH-key properly set on both sides (private key on your PC and public on your account in the hub you are using).

  3. You are using HTTPS, but mistyping your credentials on the authorization stage.

If the data is not critical, try checking URL and using insecure HTTP. If it works, then check your SSH keys / credentials. Otherwise, check the URL one more time.

Hope that helps!

Here is a good source on GIT-related information: Git for beginners: The definitive practical guide

Upvotes: 6

Aneeq
Aneeq

Reputation: 69

I had the same problem and it is solved by using HTTPS instead of SSH. Please find the detail in the this link

Upvotes: 2

Related Questions