Reputation: 61
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
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:
You are pushing to a wrong repository (check its URL).
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).
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