Gitlab http basics access denied - gitlab

I tried using this commands before getting errors
git remote add name url
git add .
git commit -m 'message'
git push -u name master

The question should be more clear. Error messages should be posted.
If you logged in GitLab with GitHub account, you'll have to set up a password for GitLab in order to log into GitLab account.
The fastest way to do so is to change your password in GitLab. You should see only new password fields.
After that, you'll have no trouble pushing.

Related

Pushing to git with Personal Access Token is asking for password

I have a shell script file which will push the files to empty git repo.
git init
git add .
git commit -m "first commit"
git remote add origin https://<my-personal-access-token>#github.com/<organization-name>/<repo-name>.git
git push -u origin master
This was pushing files to repo without asking for password, but surprisingly now it is asking for password too.
Why is it asking for password even though I used personal access token? What is going wrong here?
Even if I input correct password manually, it says as below :
You can try below line in your code for git remote step by adding username to it:
git remote add origin https://username:<my-personal-access-token>#github.com/<organization-name>/<repo-name>.git

Gitlab pushing first project failed due to could not read from remote repository

I was new to Gitlab was trying to push my project from local machine to Gitlab.
Have done the SSH key and followed the instructions at Gitlab. Done the Git global setup. Was trying to add an existing folder , so i followed the instructions listed
cd existing_folder
git init
git remote add origin https://gitlab.com/sss/testnode.git
git add .
git commit -m "Initial commit"
git push -u origin master
but failed at the last step at the git push. The error message was
Tried adding the remote origin, but it was told it already exists. So not sure where it went wrong. Please help, much appreciated :)
Have done the SSH key
The problem is that you have defined your origin as HTTPS, not SSH.
Try:
git remote set-url origin git#gitlab.com:sss/testnode.git
That will override origin URL.
Independently, make sure your SSH key does work and allows GitLab to authenticate you as your GitLab account with:
ssh -T git#gitlab.com
Check out your credentials, if they are invalid, it wont give u to upload changes.
For Windows check this: https://www.digitalcitizen.life/credential-manager-where-windows-stores-passwords-other-login-details
For Linux check this: https://askubuntu.com/questions/30907/password-management-applications (if you do not know how to change credentials via terminal)

Git pull/clone with username and password in AWS Code Commit

I Need to do a git pull using https url as a oneline command . this command I need to integrate in a bash script . But all the time it is asking the usernmae and password .
The repository is in AWS codecommit
Try this:
git clone https://username:password#git-codecommit.us-east-1.amazonaws.com/v1../repos../..
This way worked for me for CodeCommit (AWS) repository
Check this link: Enter user password in command
As is described perfectly in that post, you basically have three options:
Store the password in .netrc file (with 600 permissions). Make sure you clone the repo specifying the username in the url.
Clone the repo with https://user:pass#domain/repo . Take into account that your password will be visible in several places...
Use the credential helper.
As an update, AWS has released their remote git remote codecommit. With proper IAM setup, you can do oneline pulls without even passing username and passwords. This is now the recommended method by AWS. It can be setup on your local or on a container that's running in an AWS Pipeline for example.
i.e. git clone codecommit://HelloWorldRepo myLocalHelloWorldRepo
And then you can git pull as normal.
Full documentation is here:
https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html

How to push code using Github API?

I want to push a directory to Github via nodejs app. Here's what I currently do.
I take username, password and new repository name from user. Then, I create new repository via Github API(https://developer.github.com/v3/repos/#create).
Now I want to push some specific code to this repository. I can't use node.js child process (git push origin master), because that requires username and password.
How can I push code to Github via API. (And if via command line, then without entering password manually)
To skip the password on each commit you need to tell the git to store the credential in a separate place. This can be done by using the following command:
git config --global credential.helper cache
This will store the password for 15 minutes. If you wish you can extend this time by specifying the amount of duration in milliseconds:
git config --global credential.helper "cache --timeout=3600"

How to upload projects on gitlab by user?

We are using Gitlab (7.5.3).
I created a Repository, but I want to upload my project to it.
I've looked on the repository page for an upload button of some kind but I haven't seen anything of the sort.
I've looked at the links provided so far but I'm still getting nowhere. They mention command line, is that Windows command line ?
I am able to upload through Git GUI, how to upload without Git GUI?
And when I login to user account through putty ,it shows
login as: root
root#192.168.1.5's password:
Last login: Tue May 26 12:20:10 2015 from 192.168.1.12
![grep: write error]
Does anyone knows how we can solve these issue?
If you have Git GUI, you probably also have Git Bash which provide command line support for git inside Windows.
You can use this Git Bash to upload your project. For this, you just need some git command, and you don't have to log in the Gitlab's server (I supposed it's why you tried). This command are provided by Gitlab when you create a new project and want to upload it.
First open Git Bash. Then :
cd c:\Users\Me\..\my_project\ # Go to your project directory in Windows
git init # Initialize this directory as a git repo
git remote add origin git#your_gitlab_server_ip:your_username/your_project_name.git
git push -u origin master` # Send your code to your Gitlab instance
It's also a good idead to provide to git some info about you. This infos will be displayed by Gitlab :
git config --global user.name "Your Name"
git config --global user.email "your_name#your_mail.com"
Remember that with Gitlab the only interaction between your git's repo and Gitlab should happend through the git command, and not with login to this server.
Try this 4 step push project to gitlab --> open command line.
cd to/path/local
git init
git remote add anything_name name http://scmgit.ktb/username/projectname.git
git push -u test anything_name master
Hope is save you day.

Resources