when I run get_source.sh something wrong
./get_source.sh ERROR: Need initial repository to use this script
this is history:
1. hg init jdk8
2. hg -r pull 20 http://hg.openjdk.java.net/jdk8/jdk8
3. hg pull -r 500 http://hg.openjdk.java.net/jdk8/jdk8
4. hg pull -r 941 http://hg.openjdk.java.net/jdk8/jdk8
5. chmod +x get_source.sh
6. ./get_source.sh
hg init jdk
cd jdk/.hg
eamcs -nw hgrc
example repository config (see "hg help config" for more info)
[paths]
default = http://hg.openjdk.java.net/jdk8u/jdk8u60/
path aliases to other clones of this repo in URLs or filesystem paths
(see "hg help config.paths" for more info)
#
default-push = ssh://jdoe#example.net/hg/jdoes-fork
my-fork = ssh://jdoe#example.net/hg/jdoes-fork
my-clone = /home/jdoe/jdoes-clone
[ui]
name and email (local to this repository, optional), e.g.
username = Jane Doe
end
You can follow the following instructions which i took from readme file for downloading source code. They worked for me.
hg clone http://hg.openjdk.java.net/jdk8/jdk8 YourOpenJDK
cd YourOpenJDK
bash ./get_source.sh
Related
I'm trying to use one of projects hosted in gerrit as a dependency in golang.
I installed go-import plugin in gerrit
I added this to .gitconfig:
[url "ssh://myuser#gerrit.example.com:29418"]
insteadOf = https://gerrit.example.com
Now I run:
go get gerrit.example.com/myproject
but it fails with:
go get: module gerrit.example.com/myproject: git ls-remote -q origin in /home/me/go/pkg/mod/cache/vcs/513f491cb527a8cec5b684e8d77254c851f76499e1f725440f98d4e9ad8bbf4f: exit status 128:
fatal: project a/myproject not found
fatal: Could not read from remote repository.
Make sure that global git configuration is not setup with something along the lines:
git config --global url."git#gerrit.example.com:".insteadOf "https://gerrit.example.com"
.gitconfig
[url "git#gerrit.example.com"]
insteadOf = https://gerrit.example.com
For regular use of the git tool, it's convient to have a ~/.ssh/config file set up. In order to do this, run the following commands:
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/config
chmod 600 ~/.ssh/config
Please note the permissions on the files and directory above are essentail for SSH to work in it's default configuration on most Linux systems.
Then, edit the ~/.ssh/config file to match the following:
Host gerrit.example.com
HostName gerrit.example.com
Port 29418
User USERNAME_HERE
IdentityFile ~/.ssh/id_gerrit_example_com
Please note the spacing in the above file matters and will invalidate the file if it is incorrect.
Where USERNAME_HERE is your gerrit username and ~/.ssh/id_rsa is the path to your SSH private key in your file system. You've already uploaded its public key to gerrit.
Note: I have created this configuration just on assumption since i do not have gerrit setup to test on.
I've tried through various ways, directly uploading the files wont work. I've tried through bash and nothing.
Do you have git installed?
# Create a new repository on the command line
#Go to Project Directory on your Computer, Open git Bash here
# run the following 1 by 1
git init
git add .
git commit -m "Comment here"
git remote add origin https://github.com/YourRepoPrefixHere
git push -u origin master
If you have a git profile and a repository you can take these simple steps to get it online:
Open a terminal and go inside the folder of the project you want to push to your git repository
Check if you are on the right git branch: git checkout
git add .
git commit -m "your messagge to commit"
git push origin -u "yourbranchName
If you have never set up your origin branch, you should add it before using it:
git remote add origin "github link"
To see if everything went well you can do a simple: git status.
I hope it will be useful to you my friend!
Is it possible to run an npm script containing a git push command with the upstream option based on the current branch ?
As an example, I would like to be able to run a command npm run push.
This command will do something like git push -u origin ${current-branch} where $current-branch will be replaced by the local current git branch.
I know that this is possible to achieve it by creating a script, but I would like to know if there is already something provided by npm or git to achieve this with the minimal code requirement.
Thanks for the help !
Solution:
Vlad274's solution works.
Steps:
Add a new file .gitconfig on the root of your repository
Apply the configuration with git config --local include.path ../.gitconfig
You will be able to use a new git command which will push with the origin by using the default local branch name
I do this with a git alias, but I assume the same commands would work via npm.
In ~/.gitconfig:
[alias]
branch-name = "!git rev-parse --abbrev-ref HEAD"
pub = "!f(){ git push -u origin $(git branch-name); };f"
Git version: 2.13.0.windows.1
OS: Windows 7
CLI: Git bash
.gitconfig
[user]
name = Gyandeep Singh
email = private#email.com
[push]
default = current
[core]
autocrlf = input
[includeIf "gitdir: ~/Documents/webstorm/corporate/"]
path = .gitconfig-work
.gitconfig-work
[user]
name = Gyandeep Singh
email = corporate#email.com
Both the config files above sit together in the same directory (home).
What happened: open CLI on a folder (example test) inside corporate folder and then run git config user.email the output is private#email.com.
Expected: Outcome should be corporate#email.com.
Am I doing something wrong or my expectation is not correct? I did follow the git docs.
Solution
You have to run git config --show-origin --get user.email on a git initialized directory. If its not git initialized then the includeIf gitdir functionality will not work.
Its strange but true. I wish it still worked.
Your global C:/Users/<user-name>/.gitconfig should have this includeIf:
[includeIf "gitdir:C:/Users/<user-name>/Documents/webstorm/corporate/"]
path = .gitconfig-work
with having your work Git repos in C:/Users/<user-name>/Documents/webstorm/corporate and the conditional work configuration should be located at C:/Users/<user-name>/.gitconfig-work.
That's at least working for me in Window's cmd and Cmder. A git config --show-origin --get user.email should than show you from where a config value is loaded/resolved.
It also seems like the conditional work configuration is only used when issued from within a Git repository.
C:\Users\<user-name>\Documents\webstorm\corporate
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig foo#oss.com
C:\Users\<user-name>\Documents\webstorm\corporate\some-repo
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig-work foo#company.com
C:\Users\<user-name>\Documents\webstorm\corporate\some-non-repo-dir
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig foo#oss.com
You need to turn off case sensitivity: change "gitdir:" to "gitdir/i:"
[includeIf "gitdir/i:C:/Work/"]
path = .gitconfig-work
[includeIf "gitdir/i:C:/My/Dev/"]
path = .gitconfig-my
from:
https://github.com/Microsoft/vscode/issues/62921#issuecomment-437693020
The accepted answer, while helpful, does not answer the question.
As of this writing, includeIf only works inside a git initialized folder.
So if you cd into "~/Documents/webstorm/corporate/somegitproject" and run the command the output will be as expected:
$ cd ~/Documents/webstorm/corporate/somegitproject
$ git config user.email
corporate#email.com
This is probably a defect against git, since a user would expect this to work similarly in "~/Documents/webstorm/corporate/" as well.
There is a typo here:
[includeIf "gitdir: ~/Documents/webstorm/corporate/"]
path = .gitconfig-work
There should be no space after gitdir::
[includeIf "gitdir:~/Documents/webstorm/corporate/"]
path = .gitconfig-work
Removing it will correct the behavior within an initialized Git repository.
This will show the entire Git configuration and what Git config files it is drawn from:
git config --list --show-origin
CAVEAT: If you run this inside a Git repository it will show values from .gitconfig-work, but it will not if you are within ~/Documents/webstorm/corporate/, but outside a Git repository.
The OP concludes that includeIf functionality does not work in normal non-git directories.
This is provably incorrect for at least the configuration item core.sshCommand. If a conditionally included .gitconfig has a core.sshCommand configured, it is used in git clone operations in normal non-git directories.
It seems that the part that doesn't work properly is the display of conditionally included configuration. Which is quite problematic and interferes with tracking down broken configurations.
I mapped a directory to a drive on a windows machine with subst D: <mapped directory>. If you want to know the path of your repository you can use this command in the repository context:
git rev-parse --show-toplevel
The output was something like this:
<mapped directory>/<name of repository>
So I changed it to:
[includeIf "gitdir:<mapped directory>/"]
path = .gitconfig-work
Now it works for me.
I have created a git server on my Windows 7 box following Tim Davis' tutorial
Got everything working up to the part of actually trying to clone the repository.
I have a repo located on my server at:
C:\SSH\home\repos\testapp.git that I have initialized using git --bare init as per the tutorial, and try to clone it using GiT GUI via:
ssh://repos#myurl/SSH/home/repos/testapp.git
but get an error dialog popping up describing "Clone failed. Cannot determine HEAD. See console output for details." and "Couldn't find remote ref HEAD".
I tried making a new repo out of an existing project folder (hoping that this 'ref' would magically correct itself) but the same thing message occurs.
Is there something more after a '--bare' or an 'init' that needs to be done to set the head reference?
Most probably it's failing because it is an empty repository. You can try to add an initial ( dummy commit if needed ) to the repository and try the cloning again. Steps below if you don't know to do this.
Can you do this:
cd /home/repos
mkdir testapp.wd
cd testapp.wd
git clone ../testapp.git .
<now add some file>
touch README
git add README
git commit -m "Adding a initial commit"
git push origin master
cd ..
rm -rf testapp.wd
Now see if you can do the clone that you were trying.
If remote repository is empty, it will happen. Try to commit something.