Git error: "Please make sure you have the correct access rights and the repository exists"

  • 22,000
  • Tác giả: admin
  • Ngày đăng:
  • Lượt xem: 22
  • Tình trạng: Còn hàng

I come across this error while uploading project to tát gitlab. I didn't clone from git but instead upload project. For pushing your code to tát gitlab you have two ways either using ssh or https. If you use https you have to tát enter username and password of gitlab tài khoản. For pushing you code to tát git you can use following one.

Pushing to tát Git for the first time

>$ cd
>$ mkdir .ssh;cd .ssh
>$ ssh-keygen -o -t rsa -b 4096 -C "[email protected]"

The -C parameter is optional, it provides a comment at the kết thúc of your key to tát distinguish it from others if you have multiple. This will create id_rsa (your private key) and id_rsa.pub (your public key). We pass our public key around and keep our private key — well, private. Gitlab’s User Settings is where you would then add your public key to tát your account, allowing us to tát finally push.

In your project location(Directory) use below command

git init

It Transform the current directory into a Git repository. This adds a .git subdirectory to tát the current directory and makes it possible to tát start recording revisions of the project.

Push Using https path

git push --set-upstream https://gitlab.com/Account_User_Name/Your_Project_Name.git master

Push Using ssh path

git push --set-upstream [email protected]:Account_User_Name/Your_project_Name.git master

— set-upstream: tells git the path to tát origin. If Git has previously pushed on your current branch, it will remember where origin is

master: this is the name of the branch I want to tát push to tát when initializing