Is there a way of adding username and password into the bzr checkout command? - bazaar

I'm trying to automate an install process using bash, the following Bazaar command are part of this:
bzr export /home/path bzr+https://adress
bzr checkout bzr+https://address/ /home/path
After running these commands manually I'm prompted for username and password.
Is there any way of adding username and password directly into the commands in order to avoid the prompting?
Checked the Bazaar documentation, but couldn't find a solution.

The standard format for HTTP URLs can be used to pass a username/password combination:
$ bzr checkout bzr+https://username:password#host/path /local/path
Another option would be to add your credentials to ~/.config/bazaar/authentication.conf. See this page for details: http://doc.bazaar.canonical.com/beta/en/user-reference/authentication-help.html

Related

Not able to switch to super user in terminal From robot framework

Open Connection 192.***.***.**
Login **** *******
Start Command su hdfs
Execute Command cd /home/rajesh/hive-latest/
${STDOUT1} Execute Command ls -lrt
Log ${STDOUT1}
Close Connection
*Here i am able to login. after login, not able to switch to super user. without switching to super user, its executing ls -lrt. Please help me with this if anyone knows
This is not how the ssh library works. Have a look at the documentation
The command is always executed in a new shell. Thus possible changes
to the environment (e.g. changing working directory) are not visible
to the later keywords
You can work around this by executing the command as different user, or if possible you can open another connection and login as desired user.
su - <username> -c "<commands>"

how to git clone via https with personal access token in private project gitlab

I want to git clone a private repository with two factor authentication on my mac, I already have a personal access token in my gitlab, and I'm trying to find the correct command to run on the vscode terminal.
omarfuentes#192 ~ % git clone https://gitlab.com/OmarLeonardo/frappe/proyectos/frappe-oms/frappe-server.git?personal_access_token=myaccesstoken
however the answer is:
zsh: no matches found: https://gitlab.com/OmarLeonardo/frappe/proyectos/frappe-oms/frappe-server.git?personal_access_token=myaccesstoken
If you are using a PAT (Personal Access Token) with the right scope, you should use:
git clone https://<my-user-id>:<my-token>#gitlab.com/<my-account>/<my-project-name>.git
# or
git clone https://oauth2:<my-token>#gitlab.com/<my-account>/<my-project-name>.git
That would avoid the need to URL encode your parameter.
To clarify, if you created your account with Google you can find your username in the URL to the repository. You can also see the name of your project there. So if your URL looks like the below:
https://gitlab.com/me1234567/myproject/-/tree/main
your final command would look like this:
git clone https://oauth2:my-personal-token-123#gitlab.com/me1234567/myproject.git
The User ID you see under the Gitlab Edit profile can not be used, nor your email address or the "username" you see under your avatar which starts with #

How to connect a project from IDEA to Gitlab

Is it possible to connect a project from IDEA to Gitlab?
There are no problems with GitHub, you specify a github account, then VCS-> Import into and it creates a project in your account. But with GitLab I don't see such a possibility. Maybe there is some way?
Or just manually throw it in there?
If all you want to do is create a project, that is as simple as pushing the repo. In GitLab, you don't have to create the project in the UI first. You can simply push directly to a project namespace that does not yet exist. The project will be created when you push to it.
Therefore, all you have to do is configure your git remote per usual, then push.
git init
git checkout -b main
echo "# My Project" > README.md
git add README.md
git commit -m "initial commit"
git push --set-upstream git#gitlab.com:namespace/myproject.git main
Then you'll see the message from the remote in the git console log
remote: The private project namespace/myproject was created.
In the JetBrains IDEs, you can simply configure the remote and push.
You only have define the remote ahead of time in the terminal. For example:
git remote add origin git#gitlab.com:namespace/project
Then in the IDE, when you go to push, you'll see the ability to push to the new remote/branch.
Then you'll also note in the git tab console you'll see the message from the remote that the project has been created.
Full integration for GitLab hasn't been implemented yet, but there is a feature request for that:
https://youtrack.jetbrains.com/issue/IDEA-109294
Meanwhile, you can create a repository in GitLab, then press Cmd/Ctrl+K and Click "Commit and push". In Push dialog there will be "Define remote" button - click on it and paste URL to GitLab's repository.
If it's HTTPS then you'll be prompted with username and password - enter them, alternatively you can enter Username and Personal access token (in password field)

Vue-cli: arrow key not working while creating new project on git bash windows

I am trying to create a project which Vue-cli through Git bash Window.
Git version 2.14.1.windows.1
Vue version 3.0.0-rc.3
For some reason the cursor is still visible during installation.
And when I press any arrow key, the option does not change, only the cursor move around. (However, pressing enter still process me to the next step).
Searching for a solution with google does not let me anywhere, only a few Github bug report: https://github.com/vuejs/vue-devtools/issues/283
I had the same issue. The solution I came up with was:
$ winpty vue.cmd create `<project-name>`
Surprisingly, Windows Command Prompt is not suffered from this bug. So my solution is:
Hold Shift + Right click project folder -> choose Open command window here
This does not solve the root cause. If you happen to know a better option, please post your answer.
Note:
If you get error cannot execute scripts on powershell, then you need to enable script execution. Run powershell as administrator and run the following command to enable scripts on it:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
UPDATED 2021, Apr 4th!
Here's a CTRL+C and CTRL+V step-by-step practical solution to solve this. The fact that you have this trouble means you are on Windows and you most likely use Git Bash.
Using Git Bash a quick solution would be typing
echo 'alias vue="winpty vue.cmd"' >> ~/.bashrc
This will not overwrite .bashrc, and instead append the text on the left of >>
Restart your bash. That means close it and open it again.
If you're looking for "Why do I have to add such thing to .bashrc?", I think another user has mentioned that. If you found this helpful please upvote it so others can see it too.
Old answer
You can try to make a file .bashrc in your current <UserNameProfile>.
Then, inside of it use your favourite text editor and write
alias vue='winpty vue.cmd'
Then restart your bash. And you should be able to use vue as it should be on the documentation.
There are two ways to solve this issue which is explained in the Vue CLI Documentation:
1 - You must run the command as winpty vue.cmd create hello-world.
2 - If you still want to use the vue create hello-world syntax. You'll need to add the following line, alias vue='winpty vue.cmd', to your ~/.bashrc file. Then, you'll need to restart your Git Bash terminal session to pull in the updated bashrc file.
Git Bash is not an interactive shell. That's why you should use something that is by default interactive such as CMD or you have to do as mentioned in the Vue CLI doc:
If you are on Windows using Git Bash with minTTY, the interactive
prompts will not work. You must launch the command as winpty vue.cmd
create hello-world. If you however want to still use the vue create
hello-world syntax, you can alias the command by adding the following
line to your ~/.bashrc file. alias vue='winpty vue.cmd' You will need
to restart your Git Bash terminal session to pull in the updated
bashrc file.
Vue CLI is an interactive CLI. But Git Bash is not an interactive shell. That's why it won't work. Source

SVN change username

I found a lot of examples on how to change the username for specific revisions and so on.
But what I need is this:
I did a checkout with the authentication credentials of a workmate and need to change it to my credentials for future commits.
I cannot just checkout with my credentials due to the many changes that have been done already...
Anyone familiar with this?
You can change the user with
Subversion 1.6 and earlier:
svn switch --relocate protocol://currentUser#server/path protocol://newUser#server/path
Subversion 1.7 and later:
svn relocate protocol://currentUser#server/path protocol://newUser#server/path
To find out what protocol://currentUser#server/path is, run
svn info
in your working copy.
The easiest way to do this is to simply use the --username option on your next checkout or commit. For example:
svn commit --username newUser
or
svn co --username newUser
It will then be cached and will be used as the default username for future commands.
See also:
In Subversion can I be a user other than my login name?
I’ve had the exact same problem and found the solution in Where does SVN client store user authentication data?:
cd to ~/.subversion/auth/.
Do fgrep -l <yourworkmatesusernameORtheserverurl> */*.
Delete the file found.
The next operation on the repository will ask you again for username/password information.
(For Windows, the steps are analogous; the auth directory is in %APPDATA%\Subversion\).
Note that this will only work for SVN access schemes where the user name is part of the server login so it’s no use for repositories accessed using file://.
The command, that can be executed:
svn up --username newUsername
Works perfectly ;)
P.S. Just a hint: "--username" option can be executed on any "svn" command, not just update.
Go to Tortoise SVN --> Settings --> Saved Data.
There is an option to clear Authentication Data, click on the clear button, and it will allow you to select which connection you wanted to clear userid/pwd for.
After you do this, any checkout or update activity, it will reprompt for the userid and password.
If your protocol is http and you are using Subversion 1.7, you can switch the user at anytime by simply using the global --username option on any command.
When Ingo's method didn't work for me, this was what I found that worked.
for Win10 you should remove this folder and close/open your IDE
C:\Users\User\AppData\Roaming\Subversion\auth
, also in my projects no ".subversion" folders, only ".svn"
Also, for those who happened to realize too late, that they committed with the wrong credentials, the solution (after the fact) is to change the svn author of that revision: see this question
Basically the syntax is:
svn propset --revprop -r (revision_number) svn:author (new username)
Based on Ingo Kegel's solution I created a "small" bash script to change the username in all subfolders. Remember to:
Change <NEW_USERNAME> to the new username.
Change <OLD_USERNAME> to the current username (if you currently have no username set, simply remove <OLD_USERNAME>#).
In the code below the svn command is only printed out (not executed). To have the svn command executed, simply remove the echo and whitespace in front of it (just above popd).
for d in */ ; \
do echo $d ; pushd $d ; \
url=$(svn info | grep "URL: svn") ; \
url=$(echo ${url#"URL: "}) ; \
newurl=$(echo $url | sed "s/svn+ssh:\/\/<OLD_USERNAME>#/svn+ssh:\/\/<NEW_USERNAME>#/") ; \
echo "Old url: "$url ; echo "New url: "$newurl ; \
echo svn relocate $url $newurl ; \
popd ; \
done
Hope you find it useful!
I believe you could create you own branch (using your own credential) from the same trunk as your workmate's branch, merge from your workmate's branch to your working copy and then merge from your branch. All future commit should be marked as coming from you.
You could ask your colleague to create a patch, which will collapse all the changes that have been made into a single file that you can apply to your own check out. This will update all of your files appropriately and then you can revert the changes on his side and check yours in.
Tortoise on windows specific:
I attempted the above solution to no available. In my use case, the credentials where stored in the windows Credential Manager under the Windows Credential section and TortoiseSVN refused to change them by running the --username command.
You can edit the credentials by expanding the url for your repo and clicking edit.