Search code examples
githubgitlabgit-repo

Trouble pushing code to gitlab repository


Project owner (michael365) maintain a repository and has provided developer access to me. I am trying to push the code but I am getting this error

remote: GitLab: API is not accessible
    To gitlab.com:michael365/bim.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'git@gitlab.com:michael365/bim.git'

although I have set the public key in the SSH section, it still it doesn't work. I am issuing the following commands

$ git add .

$ git commit -m "Adding Initial Code"
On branch master
nothing to commit, working tree clean

$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

$ git push --set-upstream origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 868 bytes | 868.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: API is not accessible
To gitlab.com:michael365/bim.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@gitlab.com:michael365/bim.git'

Any suggestions would be helpful


Solution

  • pre-receive hook declined indicates that your push was rejected by remote repository after a content check on the changes you are pushing failed.

    Ask the admin of remote repo as in what check is rejecting your push. Usually you get a proper error with message stating what check failed.