6

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!

dnl-blkv
  • 2,037
  • 1
  • 17
  • 22
callmeben
  • 61
  • 1
  • 1
  • 2
  • 1
    You need to be more precise with your question. Do you know whether is some access management tool running that is authorizing or blocking your request (like gitolite or gitlab)? Also, it is very common in git environments to request merges and pull from other repos instead of pushing to them. – mattmilten Mar 04 '14 at 09:47
  • Add the full error message - block out only e.g. the domain/hostname - not the whole url. E.g. are you pushing to `git://` or `git@`? – AD7six Mar 04 '14 at 09:50
  • type in `git remote -v`: do you have access to those repositories? If not you either have to get access, or you could possibly fork those repositories so that you have your own personal copy on the server. then you'd have to make a pull request to merge your changes with main repository everyone is working on. – BenKoshy Feb 03 '18 at 23:42

2 Answers2

6

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

dnl-blkv
  • 2,037
  • 1
  • 17
  • 22
2

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

Aneeq
  • 69
  • 8