I have created one private repo, and I have the existing project on my laptop. I need to add the existing project to my repo. But when I do with terminal I am getting this below error :
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.com/sathishchinniah/Taxi-App-User.git/' not found
Steps I followed :
**Existing folder
cd existing_folder
git init
git remote add origin https://gitlab.com/sathishchinniah/Taxi-App-User.git
git add .
git commit -m "Initial commit"
git push -u origin master**
What would be an issue for this.Please help me out.Thanks
Below step solved my problem. In below command replace username
with your GitLab username and project
with your GitLab project name.
git remote set-url origin https://[email protected]/username/project.git
After you try to push to the master using bellow command it will popup a window to add credential to the repository.
git push -u origin master
The problem is that you are not referencing the repository as you should for gitlab. Instead of:
https://gitlab.com/sathishchinniah/Taxi-App-User.git
You should use:
[email protected]:sathishchinniah/Taxi-App-User.git
Gitlab uses a single defined user for cloning, pushes and pulls (and every action related) and authenticates the action thru ssh keys. You should have one for the computer you are using (the one with your working copy) and register the key as a valid key for the repository on gitlab.
First, you need to have a user defined on your local git. If not, you can do as follows to configure yours:
git config --global user.name "Your name here"
git config --global user.email "[email protected]"
Then you should create and register you key. I can further assist you with that too if you need.
Then, depending on what you want to do or how you want to start, you have a few options:
Option 1
Clone an existing repository:
git clone [email protected]:namespace/project.git
where “namespace” is the namespace of your group of projects, or your gitlab user (if no groups are defined) and “project” is the name of your project over gitlabgit push -u origin master
Option 2
Initialize the repository locally and then push the content to server:
git init
git remote add origin [email protected]:namespace/project.git
where “namespace” is the namespace of your group of projects, or your gitlab user (if no groups are defined) and “project” is the name of your project over gitlabgit push -u origin master
Option 3
Use an existing local repository:
git remote rename origin old-origin
git remote add origin [email protected]:namespace/project.git
where “namespace” is the namespace of your group of projects, or your gitlab user (if no groups are defined) and “project” is the name of your project over gitlabgit push -u origin --all
and git push -u origin --tags
to push all tagsIn your case you would like to use a new empty repository initialized locally and then push the content to repository:
git init
git remote add origin [email protected]:sathishchinniah/Taxi-App-User.git
git add .
git commit -m "Initial commit"
git push -u origin master
If it fails, please provide the errors. You should check also if you have a private key defined in your computer, and if the key is defined as a valid key for your repository at gitlab.
Hope it helps.
While cloning the code Gitlab, add your credentials in the URL:-
git clone https://{username}:{password}@gitlab.com/.../
But this is not good from the security perspective.
If you are using windows, then delete the existing entries for gitlab in Windows Credential Manager. This is present under Control Panel.
After deleting the credential, clone the repository again, you should see a window asking for credentials.
In my case, the root cause is that I was trying to access the repository from a different account which was saved in Windows Credential Manager.
Since this is a private repository, you'll need to provide credentials for this server. Try :
git remote add origin ssh://[email protected]/sathishchinniah/Taxi-App-User.git
or
git remote add origin https://[email protected]/sathishchinniah/Taxi-App-User.git
It should prompt for the password.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With